[Greasemonkey] speed and profiling of GM scripts
Tony Chang
tony at ponderer.org
Mon Jun 6 14:27:47 EDT 2005
On Mon, Jun 06, 2005 at 03:39:50PM -0400, Anthony Lieuallen wrote:
>
> > - - are there major speed gotchas in the DOM navigation API to watch out
> > for? any generic speedup tips for GM scripts?
>
> Avoid innerHTML if possible. Again I don't have any evidence at the
> moment but I'm quite certain direct DOM manipulation is faster.
> Plenty of GM scripts like linkify out there which you can use as
> examples.
I think PPK would disagree with you:
http://www.quirksmode.org/dom/innerhtml.html
In this specific example, my guess is that it won't matter much because
the amount of code you're generating is small. I would think that the
slowness has to do with having to re-render the table for every cell
change. You may get a speed increase if you set the display to 'none' on
the table, do your modifications, then make the table visible again. But
that's just speculation.
Tony
--
Tony Chang
http://ponderer.org
More information about the Greasemonkey
mailing list