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

SortedSet is much slower than Hash #3476

Papierkorb opened this Issue Nov 20, 2015 · 2 comments


None yet
2 participants

Papierkorb commented Nov 20, 2015


after some discussion over at #jruby, I decided to open an issue here.

A recent benchmark shows that SortedSet is much much slower than using a Hash (Mapping the set value to nil) when deleting items from it.

Full story:


Times from the benchmark (Taken from here)

jruby 2.2.2 java
  1.270000   0.010000   1.280000 (  1.098917)
  1.120000   0.000000   1.120000 (  1.065251)
  0.100000   0.000000   0.100000 (  0.067120) # Roughly 16x faster

Test machine:

  • Intel i5 6600K (Skylake), 4x 3.5GHz
  • 16GiB DDR-4 memory @ 2666 MHz

@kares kares added this to the JRuby milestone Jan 18, 2017

@kares kares self-assigned this Jun 23, 2017


This comment has been minimized.


kares commented Jun 27, 2017

MRI also suffers from this problem.
did not run the benchmarks but JRuby is expected will improve considerably in 9.2 with #4690

@kares kares removed their assignment Jun 27, 2017


This comment has been minimized.


kares commented Mar 1, 2018

while I did not run the specified benchmarks I have confirmed that using Set/SortedSet (in 9.2) operations are very close to native Java collection Set/SortedSet speed.

@kares kares closed this Mar 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment