Add filterA, a faster version of filterM #83
Merged
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.
Change filterM to just be filterA in order to have this be a non-breaking change; I was just thinking it would be nice for all these performance improvements to be available for people without having to update to the next major version.
This removes another use of uncons, refs #71.
The new devDependency on
Const
is because that seemed like the best choice for testing that effects are applied in the right order; the tests were not previously testing thatfilterM
applies effects in the right order.Benchmarking code:
I had to stop at 2500 elements since the current implementation stack overflows at around 3k, but the new implementation should work for much larger arrays, because of the stack-safety of the
Traversable Array
instance. I tested this implementation with up to 10k elements and it seemed to work fine.