Live data from Hacker News

Performance Improvements Using Judy Arrays

github.com

11–20 of 53 posts

Re: Performance Improvements Using Judy Arrays

#11

Something here doesn't sit right with me. Please don't launch into a lecture on algorithmic complexity and cache lines if you are running on Ruby on Rails.

Slow platforms are exactly where you need to talk algorithmic complexity. Switching to a faster environment would only reduce a routine's execution time by a constant multiplier—switching algorithms has the potential to do much more.

Re: Performance Improvements Using Judy Arrays

#13
There is some interesting things in this post but the main problem is not using Judy or something else, or talking about memory or complexity. The main problem I see here is using the wrong tool.

Replace the token matcher with a simple classifier (a maxent will work very well here) with n-gram of characters features through a hash-kernel and you get a very accurate, fast and low memory system.

I've build one two-years ago who accurately classified a bit over 100 different languages with only 64k features in the end. (So requiring only 8*64ko of memory) And this was without using file extensions as they weren't available in our case.

Before any hard optimizations, first check the methods used, and next the algorithm, anything else should go after.

Re: Performance Improvements Using Judy Arrays

#14
The article's credibility is significantly reduced by referring to Judy Trie lookups as O(log n) operations. They're actually O(log w) operations: the number of operations is bounded by the array's word size, not the size of the Judy array. A million elements in a Judy32 array will cause at most 7 node hops, not the 20 you'd expect from a binary tree.

Re: Performance Improvements Using Judy Arrays

#15

Something here doesn't sit right with me. Please don't launch into a lecture on algorithmic complexity and cache lines if you are running on Ruby on Rails.

Slow platforms are exactly where you need to talk algorithmic complexity. Switching to a faster environment would only reduce a routine's execution time by a constant multiplier—switching algorithms has the potential to do much more.

That's not what I mean. I think that any half-decent implementation in C would have been better than their current Ruby solution. And instead of spending all that time to research Judy arrays and other magic bullets, they could have already identified another problem zone and fixed it.

This just feels like "we have this huge and slow Ruby behemoth here, but using magic Judy arrays we made this little gear turn insanely fast!".

Re: Performance Improvements Using Judy Arrays

#16
post #12

Sometimes Mods change the title to be the original article title. And sometimes they change it from the original article title to something else!

Yes... they change it to the original unless it's really clear the original change was super necessary. In cases when the original title tells you nothing of the content, they change it to something useful. Seems like a pretty transparent and reasonable heuristic to me.

Re: Performance Improvements Using Judy Arrays

#17
post #9

I would have liked to seen the Judy array implementation in pure Ruby, so we could compare apples to apples. I'm not trying to troll... but basically they solved their problem by: * Avoiding Ruby language features * Rewriting it in a different language This is why I lean towards static languages like Go, Scala, and Java.

Have a look at Crystal as well.

https://github.com/manastech/crystal

Re: Performance Improvements Using Judy Arrays

#19
post #5

Wow this is an incredibly interesting and accessible article on performance tuning. I have two questions: 1) Is there an easy tutorial somewhere on calling out to native code from Ruby? 2) Could the team at Github possible give a little more detail on what you did to get all of those pretty benchmarking graphs? How did you get all of the info on memory usage and CPU activity (I assume it wasn't just time {command} >…

> 1) Is there an easy tutorial somewhere on calling out to native code from Ruby?

The canonical documentation is here: https://github.com/ruby/ruby/blob/trunk/README.EXT

Post reply on HN