-
Notifications
You must be signed in to change notification settings - Fork 15
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
Ideas for improving performance of transducers and reducers #351
Comments
cc @samdphillips and @rocketnia |
Another idea: make This would reduce the need to go through the |
Here is a branch (in my fork) where I used no contract versions of I don't have the numbers handy, IIRC in the case of |
EDIT: the headline of this should probably be I tested this program with the contract profiler. The changes that I made in the above branch were against a
|
Yikes, checking the consumer contract of (transduce (in-range 1000000)
(mapping values)
(mapping values)
(mapping values)
(mapping values)
(mapping values)
#:into
(into-for-each void)) ...would add at least another 40 seconds or so. Maybe we need transducer fusion? |
Expanded on an idea for transducer fusion in #358. |
Transducing
|
My goodness |
I've written a small microbenchmarking library called Atomichron. Hopefully we can use this to get a better sense of the performance problems in Rebellion. |
I made an example Atomichron benchmark that measures the performance of
|
Improves jackfirth#351 Because there are contracts on the creator and accessors for the transducer callbacks each applies the same contract on the callbacks. This change weakens the contract on the accessors, and should not change any contractual obligations provided transducers are created with `make-transducer`. This provides modest performance improvements: - [Vector to List - 1000000 elements](https://gist.github.com/samdphillips/92dd56e1fc78884230dbc59aabf6f1c0#file-vector-list-rkt) - 32s -> 22.4s - [1000000 Range to Void](https://gist.github.com/samdphillips/92dd56e1fc78884230dbc59aabf6f1c0#file-identity-rkt) - 30s -> 19.8s - [1000000 Range pass through 5 `mapping` to Void](https://gist.github.com/samdphillips/92dd56e1fc78884230dbc59aabf6f1c0#file-map5-rkt) - 283s -> 206s
Linking performance benchmarks Jack has written here, so we can use them for comparisons. https://gist.github.com/jackfirth/9596dd48536344b4b94c1938a36de4c9 |
Make variants intern themselves upon construction when they're wrapping values that are interned, like fixnums, symbols, booleans, keywords, and singletons. Could turn operations like
into-nth
andinto-sum
into zero-allocation operations (sometimes), and it will make all stateless transitions (i.e. returning(variant #:<kw> #f)
from a state transition handler) zero-allocation.Consider adding a way for users to force a variant to be interned, so that transducer/reducer implementations that use mutable state can be zero-allocation.
Add special case dispatching to
transduce
andreduce-all
when the input sequence is a list. Possibly add special case dispatching totransduce
when the#:into
argument isinto-list
.Use transducer composition to implement
transduce
, instead of repeatedly folding over the input sequence within-transduced
. This should remove a bunch of generic interface dynamic dispatch overhead.Add
no-contract
submodules and use them in various places.The text was updated successfully, but these errors were encountered: