-
Notifications
You must be signed in to change notification settings - Fork 50
fast functor updated #157
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
Merged
Merged
fast functor updated #157
Conversation
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
2017 MacBook Pro 2.3 GHz Intel Core i5, 8 GB 2133 MHz LPDDR3 Node v8.9.1 List ==== map --- map: empty list mean = 1.31 μs stddev = 11.87 μs min = 799.00 ns max = 375.82 μs map: singleton list mean = 2.40 μs stddev = 11.03 μs min = 1.03 μs max = 342.18 μs map: list (1000 elems) mean = 143.41 μs stddev = 225.12 μs min = 97.16 μs max = 2.03 ms map: list (2000 elems) mean = 274.16 μs stddev = 295.84 μs min = 199.66 μs max = 2.06 ms map: list (5000 elems) mean = 531.84 μs stddev = 512.61 μs min = 229.45 μs max = 2.95 ms map: list (10000 elems) mean = 895.24 μs stddev = 777.87 μs min = 464.59 μs max = 2.94 ms map: list (100000 elems) mean = 33.45 ms stddev = 7.65 ms min = 22.07 ms max = 63.47 ms
Addresses #131 The relevant chunk sizes (5 for the initial list segment), (3 for the tail-recursive remainder) were arrived at through benchmarked experimentation, mapping a simple (_ + 1) through lists of various sizes. Relevant figures: list of 1000 elems: 142.61 μs -> 36.97 μs list of 2000 elems: 275.17 μs -> 55.33 μs list of 10000 elems: 912.73 μs -> 208.39 μs list of 100000 elems: 34.56 ms -> 1.24 ms The ~30x speed increase for long lists is probably explained by the lack of GC thrashing with this approach. Benchmarked on 2017 Macbook Pro, 2.3 GHz Intel Core i5, 8 GB RAM. macOS Sierra 10.12.6 node v8.9.1
this lower the probability of stack-size troubles
begin with reverse unrolled map
natefaubion
reviewed
Mar 10, 2019
Cool to see this happen! |
@matthewleon thanks again for this, and sorry it slipped under the radar for so long! |
This was referenced Mar 10, 2019
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.
This is @matthewleon's faster
List.map
, from #135, updated for 0.12.