-
Notifications
You must be signed in to change notification settings - Fork 0
Use specialization higher than 4 #2
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
Comments
The downside is multiple dispatch to the different implementations. It's very unlikely that you want to have 10 different classes "for performance" because in a case with mixed sizes, it will probably make everything quite a bit slower. It may be good to have a single class that handles more than one fixed size to partially get around the dispatch penalty. (You still effectively have to pay it within that class as you dispatch to the different sizes there, but at least you keep that from impacting the performance of larger sizes.) |
Would using Also do you know if there is any theory as to why 4 was selected as a specialization size for |
I'm assuming that 4 was selected due to benchmarking, but I wasn't involved in that. |
Okay thanks, I will see what I can do to improve the specialization more now that I have something basic for regression tests. I am guessing that https://github.com/scala/collection-strawman/tree/master/benchmarks/time/src/main/scala/strawman/collection/immutable is a good reference on the type of benchmarks I should be writing? |
In general, yes, but they're not always designed to explore the performance penalty of multiple dispatch. In that case you have to test operations on a set of small collections of different sizes. |
Uh oh!
There was an error while loading. Please reload this page.
The current
VectorMap
implementation copies the same method of specialization asHashMap
which specializes up until arity 4.As can be seen by the basic jmh benchmarks,
LinkedMap
is a non trivial amount slower than aHashMap
when we are no longer specialized (~30%) so it may be useful to increase the specialisation (just for LinkedMap) to be a bit higher, maybe up to 8 or even 10?I am not completely aware of the downsides of this, @Ichoran would you be able to comment?
The text was updated successfully, but these errors were encountered: