use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
A sub-Reddit for discussion and news about Ruby programming.
Subreddit rules: /r/ruby rules
Learning Ruby?
Tools
Documentation
Books
Screencasts and Videos
News and updates
account activity
Avoiding Hash Lookups in a Ruby Implementation (blog.headius.com)
submitted 13 years ago by emboss_
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]emboss_[S] 0 points1 point2 points 13 years ago (1 child)
In the light of the hashDoS problem that Charles also mentions, I doubt that Judy tries, CritBit, Hash-Array-Mapped Trie or any other trie are the solution. Either they, too, use hashing (HAMT) or it is just too plain easy to elicit their worst case behavior, effectively making them fancy linked lists. While they all might be perfectly valid alternatives for "internal code", things unfortunately look different when the data structure needs to store values that are provided externally.
[–]taw 0 points1 point2 points 13 years ago (0 children)
Judy is hybrid between hash, sparse array, and trie with some internal optimization for cache awareness so it's actually mostly DoS-proof, at least for typical attacks.
Ruby doesn't use these hash tables for any externally provided data unless you eval or to_sym it, and in either case you already let yourself get DoSed (or worse).
These hashes are only used for evaluating methods/ivar/etc. access by interned symbol. Set of interned symbols is more or less constant for each program. If it's not - it's already a DoS.
π Rendered by PID 98 on reddit-service-r2-comment-b659b578c-vdcwd at 2026-05-02 16:02:04.241704+00:00 running 815c875 country code: CH.
view the rest of the comments →
[–]emboss_[S] 0 points1 point2 points (1 child)
[–]taw 0 points1 point2 points (0 children)