in reply to Re^2: WWW::Mechanize::Firefox latency using RemoteObject
in thread WWW::Mechanize::Firefox latency using RemoteObject
This is just as you suspected - each attribute access involves at least one roundtrip over TCP from Perl to Firefox and back. There is little you can do except avoid accessing Javascript data from Perl, or to make bulk requests.
Likely, the CPU time gets split up between Firefox and Perl and the kernel for the Network, and I'm not sure how your monitoring accounts for time spent in the kernel.
Update: If you start to optimize your application and try to reduce the accesses to Javascript objects, the object bridge has some counters that might be of help:
stats => { roundtrip => 0, # total number of roundtrips fetch => 0, # number of attribute fetches store => 0, # number of attribute stores callback => 0, # number of callbacks triggered },
use Data::Dumper; my $repl = $mech->repl; warn Dumper $repl->{stats};
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: WWW::Mechanize::Firefox latency using RemoteObject
by hansendc (Novice) on Apr 09, 2011 at 23:50 UTC |