-
Github get good results using Judy arrays to replace a Ruby hash. However: the whole blog post is a bit dodgy to me. It feels like there are much better ways to fix the problem: 1. the big one: don’t do GC-heavy activity in the front-end web servers. Split that language-classification code into a separate service. Write its results to a cache and don’t re-query needlessly. 2. why isn’t this benchmarked against a C/C++ hash? it’s only 36000 entries, loaded once at startup. lookups against that should be blisteringly fast even with the basic data structures, and that would also be outside the Ruby heap so avoid the GC overhead. Feels like the use of a Judy array was a “because I want to” decision. 3. personally, I’d have preferred they spend time fixing their uptime problems…. See also https://news.ycombinator.com/item?id=5639013 for more kvetching.
(tags: ruby github gc judy-arrays linguist hashes data-structures)