ruby-core@ruby-lang.org archive (unofficial mirror)
 help / color / mirror / Atom feed
* [ruby-core:98292] [Ruby master Bug#16851] Ruby hashing algorithm could be improved using Tabulation Hashing
@ 2020-05-12 17:55 anamma06
  2020-05-12 18:19 ` [ruby-core:98294] [Ruby master Feature#16851] " jean.boussier
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: anamma06 @ 2020-05-12 17:55 UTC (permalink / raw)
  To: ruby-core

Issue #16851 has been reported by ana06 (Ana Maria Martinez Gomez).

----------------------------------------
Bug #16851: Ruby hashing algorithm could be improved using Tabulation Hashing
https://bugs.ruby-lang.org/issues/16851

* Author: ana06 (Ana Maria Martinez Gomez)
* Status: Open
* Priority: Normal
* ruby -v: master
* Backport: 2.5: UNKNOWN, 2.6: UNKNOWN, 2.7: UNKNOWN
----------------------------------------
I have implemented Linear Probing and Simple tabulation in Ruby: https://github.com/Ana06/ruby/compare/master...Ana06:tabulation_project

I tested it using the following code:
https://github.com/Ana06/ruby-tabulation/blob/master/benchmark_tabulation.rb
It benchmarks the insertion of 600000 elements (by hashing their 64 bits ids) in an empty hash 100 times. Below are the times (in seconds) I got executing this code for different versions of the Ruby code:

- master (without Simple Tabulation): 29.68
- master with Linear Probing (without Simple Tabulation): 99.76
- master with Quadratic Probing (without Simple Tabulation): 29.97
- master with Simple Tabulation: 15.76
- master with Linear Probing and Simple Tabulation: 24.23
- **master with Quadratic Probing and Simple Tabulation: 13.73**

`master` refers to ruby 2.8.0dev:
(2020-05-07T16:22:38Z master 7ded8fd) [x86_64-linux].
I tried with 8 x Intel i5-8265U.

Although this is just a prove of concept and not something that could be already use in production, I think it proves the potential of Simple Tabulation to improve current Ruby implementation. It may be worthwhile to explore this idea further. What do you think?

I did this as part of a project for my [Advanced Algorithms course](http://www.cs.columbia.edu/~andoni/advancedS20/index.html). For more details check the project report: 
https://github.com/Ana06/ruby-tabulation/blob/master/latex/RubyTabulation_Project.pdf



-- 
https://bugs.ruby-lang.org/

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-10-22  9:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-12 17:55 [ruby-core:98292] [Ruby master Bug#16851] Ruby hashing algorithm could be improved using Tabulation Hashing anamma06
2020-05-12 18:19 ` [ruby-core:98294] [Ruby master Feature#16851] " jean.boussier
2020-05-13  1:48 ` [ruby-core:98308] " matz
2020-05-14 21:00 ` [ruby-core:98364] " anamma06
2020-10-22  6:12 ` [ruby-core:100494] " mame
2020-10-22  9:18 ` [ruby-core:100497] " mame

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).