Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove fold() closures from
FieldSet._hashCode
. (#554)
The fold() calls come with significant runtime cost, and make it more difficult to hoist accesses to commonly used variables. Just rewriting this pattern shows a significant performance improvement for both JS and VM benchmarks. Baseline ``` JS HashCode(RunTime): 9833.333333333334 us. HashCode(RunTime): 9891.625615763547 us. HashCode(RunTime): 9607.655502392345 us. HashCode(RunTime): 9661.835748792271 us. HashCode(RunTime): 9765.853658536585 us. VM HashCode(RunTime): 4527.384615384615 us. HashCode(RunTime): 4534.151583710407 us. HashCode(RunTime): 4546.556818181818 us. HashCode(RunTime): 4490.65470852017 ``` Results ``` JS HashCode(RunTime): 8004 us. HashCode(RunTime): 7980.0796812749 us. HashCode(RunTime): 7976.095617529881 us. HashCode(RunTime): 7824.21875 us. HashCode(RunTime): 7847.058823529412 us. VM HashCode(RunTime): 2474.5451174289246 us. HashCode(RunTime): 2533.7037974683544 us. HashCode(RunTime): 2532.4556962025317 us. HashCode(RunTime): 2420.072551390568 us. HashCode(RunTime): 2521.3198992443326 ``` Co-authored-by: Loren Van Spronsen <[email protected]>
- Loading branch information