accessing unmemoized null property of a class model
bench/property-access-model-class.ts
Regression
-28%
17.5 µs24.1 µs
Improved
accessing unmemoized getter properties of a class model
bench/property-access-model-class.ts
+48%
66.6 µs44.9 µs
accessing memoized getter properties of a class model
bench/property-access-model-class.ts
+44%
15.2 µs10.5 µs
accessing memoized null property of a class model
bench/property-access-model-class.ts
+29%
14.4 µs11.2 µs
instantiating a large root
bench/all.ts
+15%
4 ms3.5 ms
Passed
instantiating a small root
bench/all.ts
+3%
46.8 µs45.5 µs
instantiating a diverse root
bench/all.ts
+2%
56.4 µs55.1 µs
instantiating a large union
bench/all.ts
-8%
86.1 µs93.8 µs
Ignored
instantiating a small root (mobx-state-tree)
bench/all.ts
Ignored
-7%
1.3 ms1.4 ms
instantiating a large root (mobx-state-tree)
bench/all.ts
Ignored
+5%
270.7 ms258.3 ms
instantiating a diverse root (mobx-state-tree)
bench/all.ts
Ignored
-4%
2.2 ms2.3 ms
instantiating a large union (mobx-state-tree)
bench/all.ts
Ignored
-3%
3 ms3.1 ms
Commits
Click on a commit to change the comparison range
Base
main
f183291
-40.13%
Eval a fast property memoizer to microoptimize property access for cached views
This implements a better performing getter function for readonly instances. Before this, we used the same definition of the getter function for all views, which ended up megamorphic, because it accessed a very wide variety of properties for every instance! Instead, this evals a monomorphic getter for each one. I also changed the object that stores the memos to have a fixed shape from birth by evaling it out as well.
I also changed us to use one object to store all the memoized values, instead of two. We were previously using two in order to implement memoization of undefined and null correctly, but with the new strategy to initialize an object with slots for every memo from the start, we can populate it with a `$notYetMemoized` symbol that indicates if we have memoized or not.
cff0d11
2 years ago
by airhorns
+12.46%
Eval a fast property memoizer to microoptimize property access for cached views
This implements a better performing getter function for readonly instances. Before this, we used the same definition of the getter function for all views, which ended up megamorphic, because it accessed a very wide variety of properties for every instance! Instead, this evals a monomorphic getter for each one. I also changed the object that stores the memos to have a fixed shape from birth by evaling it out as well.
I also changed us to use one object to store all the memoized values, instead of two. We were previously using two in order to implement memoization of undefined and null correctly, but with the new strategy to initialize an object with slots for every memo from the start, we can populate it with a `$notYetMemoized` symbol that indicates if we have memoized or not.