As I understand, declaring a map from scala stdlib doesn't specialize it to primitive types. What I'm looking for is not to pay the price of boxing/unboxing, but at the same time have the interface of scala maps. An obvious choice would be to use trove maps, but I don't believe there are scala views. Any help appreciated.
This is currently impossible because the interface is not specialized. This means that regardless of what you do in the collection itself, the values will be boxed in order to get them through the interface.
There are no particularly satisfying options at the moment; using Trove with some implicit conversions to Scala collections for those cases where convenience is more important than performance is probably the best you'll get.
(I have tried to remedy this situation myself, and can attest that it is not easy given the current state of specialization support in the compiler; specializing the existing library isn't practical right now, and creating your own is difficult at best. Hopefully future versions will improve things here, but this isn't of much use to you right now.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With