Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize iterators a bit #1363

Merged
merged 1 commit into from Nov 17, 2022
Merged

Conversation

lahma
Copy link
Collaborator

@lahma lahma commented Nov 17, 2022

  • use same type for all iterators which has faster shortcuts
  • add fast path for array get length
  • small cleanup

Jint.Benchmark.ForBencmark

Diff Method Mean Error Allocated
Old ForOfVar 164.7 μs 0.35 μs 330.99 KB
New 107.7 μs (-35%) 0.22 μs 119.95 KB (-64%)
Old ForOfLet 177.4 μs 0.64 μs 635.59 KB
New 139.8 μs (-21%) 0.30 μs 424.55 KB (-33%)
Old ForOfConst 178.6 μs 0.45 μs 635.59 KB
New 144.3 μs (-19%) 0.38 μs 424.55 KB (-33%)
Old ForVar 159.9 μs 0.67 μs 3.66 KB
New 152.4 μs (-5%) 1.62 μs 3.66 KB (0%)
Old ForLet 210.1 μs 0.44 μs 191.42 KB
New 211.8 μs (+1%) 3.48 μs 191.42 KB (0%)

* use same type for all iterators which has faster shortcuts
* add fast path for array get length
* small cleanup
@lahma lahma enabled auto-merge (squash) November 17, 2022 16:30
@lahma lahma merged commit 4259645 into sebastienros:main Nov 17, 2022
@lahma lahma deleted the iterator-optimizations branch November 17, 2022 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant