Mark Lewis
Aug 17, 2022

--

Keep in mind that the immutable Map is basically a tree structure with O(log n) access instead of O(1) access, so it is almost certain to be slower for large amounts of data.

Have you considered testing this with GraalVM? I'd be very interested in seeing how is compared to the newest openjdk implementations. I know that Graal used to have a significant performance advantage because for Scala programs. I think the main reason was that it did better escape analysis to optimize the allocation of small objects.

Edit: I originally typed O(n) instead of O(1) for the hashmap access.

--

--

Mark Lewis
Mark Lewis

Written by Mark Lewis

Computer Science Professor, Planetary Rings Simulator, Scala Zealot

No responses yet