]> git.cworth.org Git - cworth.org/commitdiff
Add trender_bookmark page
authorCarl Worth <cworth@cworth.org>
Tue, 10 Jul 2007 23:16:20 +0000 (16:16 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 10 Jul 2007 23:16:20 +0000 (16:16 -0700)
src/trender_bookmark.mdwn [new file with mode: 0644]

diff --git a/src/trender_bookmark.mdwn b/src/trender_bookmark.mdwn
new file mode 100644 (file)
index 0000000..9a4f15a
--- /dev/null
@@ -0,0 +1,39 @@
+[[meta title="On-demand Trender"]]
+
+[[tag performance]]
+
+Vladimir Vukićević pointed me to an old [[blog
+entry](http://blog.vlad1.com/archives/2005/10/28/74/) where he
+provides a useful "bookmarklet" that I thought I'd share. It makes it
+easy to measure how long mozilla spends rendering any particular web
+page.
+
+My version is slightly tweaked from Vladimir's and is available here:
+<a href="javascript:c=300;skip=4;wh=1024;ww=1024;window.resizeTo(wh,ww);
+var wu=window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils);
+r = new Array(); for (var i = 0; i < c; i++) { var start = Date.now();
+wu.redraw(); var end = Date.now(); r.push(end - start); } var t=0;
+(r.slice(skip)).forEach(function(v){t+=v;});dump('Average: ' +
+(t/(c-skip)).toFixed(3) + ' \nRaw: ' + r);">Time Render</a>.
+
+The differences in mine are that it runs for 300 iterations by default
+instead of just 10, (long enough to collect very healthy profile
+information), and that it emits its result by dumping to stdout or
+stderr instead of popping up an alert box. Not only is the alert box
+hard to use when it has 300 values laid out without line-wrapping,
+but I do X server experiments where I need to measure performance even
+when things are rendering incorrectly, (so if the results are only
+displayed on the X server they are useless to me).
+
+To use this, first you'll need a recent Firefox, (I'm using a daily
+build here which works, where the system 2.0 version does not seem
+to). Just drag-and-drop the above link to the bookmark toolbar, (and
+yes, I had to turn it on just for that). You might also need to go to
+the "about:config" location in the toolbar and create a new Boolean
+entry, (right-click to find that), named
+`browser.dom.window.dump.enabled` and set it to `True`.
+
+At that point yous should be all setup. Just browse to a web page of
+interest and click the "Time Render" bookmark to measure the rendering
+performance of Mozilla on that page.
+