I’m still discovering the effects upon RubyFrontier caused by the (still experimental) switch from Ruby 1.8.7 to Ruby 1.9.3. One of the chief effects has been that RubyFrontier is way slower! The difference is visible chiefly when rebuilding the autoglossary.
Running a profile with ruby-prof led me to suspect that the source of the slowdown might by YAML. A quick googling session seemed to confirm this suspicion. So I added this line right after my initial YAML require:
YAML::ENGINE.yamler = 'syck'
This swaps out the use of the Psych library and uses the old Syck library instead. The result is that the time needed, for example, to rebuild the autoglossary for the Script Debugger 5 help dropped from 14 seconds to 7 seconds! Kind of a big difference. In fact, that 7 seconds is a second or two faster than the same task under Ruby 1.8.7. This entire affair is particularly ironic given the fact that Ruby 1.9.3 is so demanding about finding the Psych library present when you build it; if it’s missing, gem
and YAML both complain every time you use them.
Either Psych needs to work decently or gem
and YAML should shut the hell up.
UPDATE (a couple of days later): I was able to write a script showing that in Ruby 1.9.3, Psych’s load_file
in a real-world case is actually more than three times slower than Syck’s (including Ruby 1.8.7). I submitted this as a bug on Psych, because it’s slow, and as a bug on Ruby itself, because it’s ramming Psych down users’ throats when it clearly isn’t ready for prime time.
My solution in RubyFrontier in the end is to keep using Psych but to call YAML.load_file
a lot less. I might have to switch to JSON in the end, but for now things are okay.
In other news, the output format of Time#to_s
changed in Ruby 1.9, breaking some more of my code. These Ruby people really don’t care what they break, do they?
This page prepared
February 14, 2014
by Matt Neuburg, phd = matt at tidbits dot com,
using RubyFrontier.
RubyFrontier is a port, written in the Ruby language,
of the Web-site-creation features of UserLand Frontier.
Works just like Frontier, but written in Ruby!
Download RubyFrontier from
GitHub.