
A Comparison of Functional Data Structures on the JVM - prospero
https://github.com/lacuna/bifurcan/blob/master/doc/comparison.md
======
wmfiv
For those interested in this type of thing, Li Haoyi created an in depth look
at the Scala structures.

[http://www.lihaoyi.com/post/BenchmarkingScalaCollections.htm...](http://www.lihaoyi.com/post/BenchmarkingScalaCollections.html)

It includes some interesting commentary as well.

------
jvican
Note that Scala 2.13 (next release) includes a CHAMP hash map implementation,
first contributed by the original author and then refined by several Scala
contributors, most notably Jason Zaugg (@retronym) and Josh (@joshlemer)

~~~
prospero
I tried to include these, but it wasn’t immediately obvious how to construct
them from outside Scala without CanBuildFrom. If anyone wants to open a PR or
even provide a few hints, I’d be happy to update the benchmarks.

~~~
eeperson
Scala 2.13 greatly simplifies the external interface of the collections and no
longer requires CanBuildFrom [1]. You may find them much easier to work with
now.

[1] [https://scala-lang.org/files/archive/api/2.13.0-M5/](https://scala-
lang.org/files/archive/api/2.13.0-M5/)

------
agumonkey
reddit thread from a year ago
[https://www.reddit.com/r/programming/comments/5790ky/benchma...](https://www.reddit.com/r/programming/comments/5790ky/benchmarking_scala_collections/?submit_url=http%3A%2F%2Fwww.lihaoyi.com%2Fpost%2FBenchmarkingScalaCollections.html&already_submitted=true&submit_title=Benchmarking+Scala+Collections)

------
jphalimi
Thanks for sharing! One quick question: in the methodology section, you
mention that the results are from a median value out of repeated runs. While I
get that you run JITted code, you also mention that it makes the runs isolated
from GC side-effects.

Just out of curiosity, what did you do to ensure that GC would not interfere
with the execution while the tests are running?

~~~
prospero
By forcing the GC to run in between tests, basically. The README for the
benchmarking tool describes it in more detail:
[https://github.com/hugoduncan/criterium](https://github.com/hugoduncan/criterium).

------
_Codemonkeyism
Pet peeve: I wish people would call them persistent or fork-on-write, but
functional at least is better than immutable.

~~~
wging
Would "purely functional data structures" float your boat?

I suspect the idea is to tie in with the idea of '(purely) functional
programming', which is where these will shine.

In any case the term '(purely) functional data structures' seems pretty well
entrenched and dates _at least_ to Okasaki's thesis in the late 1990s,
possibly earlier (I'm not an expert). In fact, it looks like the link actually
mentions Okasaki's work.

~~~
_Codemonkeyism
So an appeal to authority? [0] Or to tradition, I'm not sure.

[0]
[https://www.logicallyfallacious.com/tools/lp/Bo/LogicalFalla...](https://www.logicallyfallacious.com/tools/lp/Bo/LogicalFallacies/21/Appeal-
to-Authority)

~~~
wging
No, not really. I'm not saying anything about what these things ought to have
been called in a perfect world (though I think it actually fits pretty well).
I'm observing that they've been called by this name for a while, so even if
you can find an unambiguously better one, popularizing it may be hard.

------
the_arun
I see you have written interfaces like List & Maps. Probably, we need to use
interfaces from Java native, but provide better implementation through
bifurcan. This makes it easy for existing applications to switch to bifurcan
where they need.

------
the_arun
Indeed great work! Is Google's guava collections part of this research?

~~~
prospero
Guava’s “immutable” collections are effectively read-only indices, and do not
support efficient updates.

------
ertucetin
Great work!

