WWW::Mechanize speed

I found the Ruby version of the following script is half as fast as the
Perl version.

Here’s a typical result on my computer:

$ time ./mech.pl ; time ./mech.rb

real 0m6.182s
user 0m0.284s
sys 0m0.030s

real 0m11.754s
user 0m0.566s
sys 0m0.068s

It’s just frustrating, especially when you’re trying to … eh, enhance
your online game score. But seriously, what the hell?


use WWW::Mechanize;

$agent = WWW::Mechanize->new();


require ‘mechanize’

agent = WWW::Mechanize.new

It is most likely the HTML parsing that is slowing things down. Does
the Perl version always parse the HTML, or only on demand?

Either way, REXML is not known to be the fastest thing in the world.