Performance Improvements

Work on improving the performance of the entity parsing stuff

Benchmarked using hyperfine with 2 warmup runs on my M1 Macbook

Entities - Previous: 14.845 s ±  0.095 s
No-Entities - Previous: 318.4 ms ±  18.1 ms

Entities - New: 1.117 s ±  0.021 s
No-Entities - New: 325.4 ms ±  16.7 ms
This commit is contained in:
Lol3rrr
2024-09-22 17:21:12 +02:00
parent c1568c4c07
commit bead8549d4
2 changed files with 8 additions and 10 deletions

View File

@@ -75,7 +75,7 @@ impl EntityContext {
None => panic!(),
};
let mut fields = Vec::new();
let mut fields = Vec::with_capacity(n_updates);
for path in paths.paths().take(n_updates) {
let field = path.find(&class.serializer)?;
let field_info = field.get_propinfo(path);
@@ -84,9 +84,7 @@ impl EntityContext {
if let Some(fi) = field_info {
if let Some(prop_info) = prop_controller
.prop_infos
.iter()
.find(|pi| fi.prop_id == pi.id)
.prop_infos.get(&fi.prop_id)
{
fields.push(EntityProp {
field_info: fi,