Forum: Ruby WWW::Mechanize speed

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
narf968 (Guest)
on 2005-12-04 21:28
(Received via mailing list)
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");



#!/usr/local/bin/ruby

require 'mechanize'

agent = WWW::Mechanize.new
agent.get("http://www.google.com")
leavengood (Guest)
on 2005-12-04 21:40
(Received via mailing list)
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
This topic is locked and can not be replied to.