Using RubyInline and C To Speed Up Polygonal Point Searches
Evan Weaver had a basic problem to solve:
We need to compute whether a point lies within a polygon. And we need to do it a lot.
Due to MySQL's lacking geometry features, Evan had to perform location searches using Ruby code to find points within certain polygons. Keen for a speed-up, Evan digs out some C code from 1987 and sets about using RubyInline to speed up the whole process. The end result? A 22x increase of speed.
Of particular interest to RubyInline newbies will be the way Evan had to adjust the C code for it to work directly on Ruby objects.