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

Fast path for Array#pop(1) #2130

Merged
merged 1 commit into from
Nov 1, 2020
Merged

Fast path for Array#pop(1) #2130

merged 1 commit into from
Nov 1, 2020

Conversation

ggrossetie
Copy link
Member

@ggrossetie ggrossetie commented Oct 15, 2020

Command

$ bundle exec rake bench:ips FILE=benchmark-ips/bm_array_pop_1.rb

Before (Node 14)

=== Files: benchmark-ips/bm_array_pop_1.rb
bundle exec opal --dynamic-require ignore --missing-require ignore -ropal/platform -gbenchmark-ips -rbenchmark/ips -A benchmark-ips/bm_array_pop_1.rb
Warming up --------------------------------------
              pop(1)    33.930k i/100ms
Calculating -------------------------------------
              pop(1)    552.367k (± 2.9%) i/s -      2.782M in   5.041536s

After (Node 14)

=== Files: benchmark-ips/bm_array_pop_1.rb
bundle exec opal --dynamic-require ignore --missing-require ignore -ropal/platform -gbenchmark-ips -rbenchmark/ips -A benchmark-ips/bm_array_pop_1.rb
Warming up --------------------------------------
              pop(1)    41.379k i/100ms
Calculating -------------------------------------
              pop(1)    803.658k (± 4.9%) i/s -      4.014M in   5.007475s

Summary

With this change, the code is now ~1.4x times faster.

@elia elia merged commit b63b3ca into opal:master Nov 1, 2020
@ggrossetie
Copy link
Member Author

Thanks 👍

@ggrossetie ggrossetie deleted the perf-pop-1 branch November 2, 2020 10: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

2 participants