# WWW::Mechanize speed

**URL:** <https://www.ruby-forum.com/t/www-mechanize-speed/49452>\
**Category:** Ruby\
**Created:** [December 4, 2005, 8:28pm UTC](https://www.ruby-forum.com/t/www-mechanize-speed/49452 "2005-12-04T20:28:01Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![narf968](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e274bd/32.png) [@narf968](https://www.ruby-forum.com/u/narf968)\
**Post date:** [December 4, 2005, 8:28pm UTC](https://www.ruby-forum.com/t/www-mechanize-speed/49452/1 "2005-12-04T20:28:01Z")

</div>

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?

#!/usr/bin/perl

use WWW::Mechanize;

$agent = WWW::Mechanize-\>new();  
$agent-\>get(“[http://www.google.com](http://www.google.com)”);

#!/usr/local/bin/ruby

require ‘mechanize’

agent = WWW::Mechanize.new  
agent.get(“[http://www.google.com](http://www.google.com)”)

---

<div class="post-metadata">

**Author:** ![narf968](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/e274bd/32.png) [@narf968](https://www.ruby-forum.com/u/narf968)\
**Post date:** [December 4, 2005, 8:40pm UTC](https://www.ruby-forum.com/t/www-mechanize-speed/49452/2 "2005-12-04T20:40:15Z")

</div>

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.

Ryan
