perf: use native builtin's for foldl and foldr#629
Merged
sbarzowski merged 4 commits intogoogle:masterfrom Sep 27, 2022
Merged
Conversation
Contributor
|
Good stuff! Would you be able to add some more testcases? Our current ones are rather rudimentary and with a native implementation we would like various cases covered, in particular:
(Afterwards we need to check that the results are expected.) |
benchmark old ns/op new ns/op delta Benchmark_Builtin_substr-8 17914126 16328579 -8.85% Benchmark_Builtin_reverse-8 360776847 346691957 -3.90% Benchmark_Builtin_parseInt-8 8686867 8314151 -4.29% Benchmark_Builtin_base64Decode-8 22157223 21749268 -1.84% Benchmark_Builtin_base64DecodeBytes-8 281975629 281841745 -0.05% Benchmark_Builtin_base64-8 23824149 23716470 -0.45% Benchmark_Builtin_base64_byte_array-8 141846327 141377054 -0.33% Benchmark_Builtin_manifestJsonEx-8 9317781 9279067 -0.42% Benchmark_Builtin_comparison-8 128783954 128362069 -0.33% Benchmark_Builtin_comparison2-8 2082396660 2029123362 -2.56% Benchmark_Builtin_foldl-8 159908963 31278937 -80.44%
72e45c5 to
9c451e2
Compare
Contributor
Author
|
Hey @sbarzowski ! Good call on improving the coverage here. It actually uncovered an edge case I hadn't covered (when the second argument is a string). I've patched this as I figure we won't want to break compatibility and added the requested tests. LMK if there are other areas you think could benefit from a test. TY 🙇♂️ |
Contributor
|
All good, thank you! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
👋
Description
When performing some profiling of one of our applications we found that calls to fold were quite slow. Using a native function is quite simple and gives some nice performance benefits.
Benchmark results:
Note: I've left off a benchmark for
foldras I suspect it would be almost identical. Let me know if you want me to add one though.Issue
#111