Closed
Conversation
Collaborator
Author
|
The performance improvements greatly depend on the number of filters. In the example @jacoscaz had with only maps - there was no gain (if anything a slight degradation of 5-10%), but if there are filters involved the speedup can be much more significant. For instance running range(0, 2_000_000)
.map((item: number) => item)
.filter((item: number) => item % 2 === 0)
.map((item: number) => item)
.filter((item: number) => item % 3 === 0)
.map((item: number) => item)
.filter((item: number) => item % 4 === 0)
.map((item: number) => item)
.filter((item: number) => item % 5 === 0)
.map((item: number) => item)
.filter((item: number) => item % 6 === 0)Goes from ~80ms to ~20ms; so a 4x speedup As a result - it may be worth only triggering this optimized iterator when we reach the first |
Collaborator
Author
|
I'm not sure I understand the cause of the failing test on node v10 |
Collaborator
Author
Collaborator
|
Done! |
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.
Supercedes #48
Supercedes #50
Makes use of this suggestion by @RubenVerborgh to provide the ~2x speedup to chained maps and transforms; without having the problems associated with immutability (to give you a sense, the test suite is now running at ~600ms on my machine vs ~1000ms before).