in reply to Re^8: WWW::Mechanize::Firefox delayed returns / slow
in thread WWW::Mechanize::Firefox delayed returns / slow

Thank you very much for sharing how you made your script faster!

That "simple assignment" is not so simple behind the scenes. It involves converting the DOM in the Firefox process to a text string and then copying that text string to the Perl process. The network connection between Firefox and Perl is not as fast as it could be, unfortunately.

  • Comment on Re^9: WWW::Mechanize::Firefox delayed returns / slow

Replies are listed 'Best First'.
Re^10: WWW::Mechanize::Firefox delayed returns / slow
by mascip (Pilgrim) on Apr 10, 2014 at 09:22 UTC
    I was assuming that ->{innerHTML} was already a string, but you're saying that it's an object, and it's the stringification that takes a long time? But... I didn't ask for it to be stringified yet.

      No - all properties are just tied wrappers for Javascript objects living on the other side in Firefox. Every access and function call has to travel from Perl to Firefox and back, and that is slow.

      If you are interested in the nasty details, I think that MozRepl::RemoteObject somewhat goes into the nasty details, and I gave one talk on the subject, albeit in German only. I'm not sure if the Google translation of the slides are usable...

        Thank you :)