Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

First synchronous hammering performance numbers

95 views
Skip to first unread message

Josh Matthews

unread,
May 27, 2013, 2:25:08 PM5/27/13
to mozilla-...@lists.mozilla.org
The following script (test_hammer_layout.html) can now run in Servo, so
I've finally been able to begin obtaining baseline performance data.
Note that this is with the exiting Rust scheduler, not Brian's new one:

>var divs = document.getElementsByTagName("div");
>var div = divs[0];
>
>var count = 1000000;
>var start = new Date();
>for (var i = 0; i < count; i++) {
> div.setAttribute('id', 'styled');
> div.getBoundingClientRect();
>}
>var stop = new Date();
>window.alert((stop - start) / count * 1e6);
>window.close();

This yields 1239493.

Cheers,
Josh

Josh Matthews

unread,
May 27, 2013, 3:45:07 PM5/27/13
to mozilla-...@lists.mozilla.org
For the sake of contrast, a current Firefox nightly shows me 1319.

Josh Matthews

unread,
May 27, 2013, 3:48:40 PM5/27/13
to mozilla-...@lists.mozilla.org
And interestingly enough, the same test with the
div.getBoundingClientRect call removed yields a marginally better 1162253.

Patrick Walton

unread,
May 27, 2013, 4:18:23 PM5/27/13
to Josh Matthews, mozilla-...@lists.mozilla.org
So I guess the problem is that setAttribute() is slow?

Josh Matthews <jo...@joshmatthews.net> wrote:

>On 05/27/2013 03:45 PM, Josh Matthews wrote:
>And interestingly enough, the same test with the
>div.getBoundingClientRect call removed yields a marginally better
>1162253.
>_______________________________________________
>dev-servo mailing list
>dev-...@lists.mozilla.org
>https://lists.mozilla.org/listinfo/dev-servo

--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.

Josh Matthews

unread,
May 27, 2013, 7:25:47 PM5/27/13
to mozilla-...@lists.mozilla.org
That appears to be the wrong conclusion; when I remove the code that
triggers the reflow from set_attr, the number drops by two orders of
magnitude. The layout task appears to be eating into the script task's
performance.

Robert O'Callahan

unread,
May 27, 2013, 9:19:05 PM5/27/13
to Josh Matthews, mozilla-...@lists.mozilla.org
I'm pretty sure that Gecko short-circuits setting of an attribute to the
value it already has, in the DOM code. So this may not be testing what you
want.

Rob
--
q“qIqfq qyqoquq qlqoqvqeq qtqhqoqsqeq qwqhqoq qlqoqvqeq qyqoquq,q qwqhqaqtq
qcqrqeqdqiqtq qiqsq qtqhqaqtq qtqoq qyqoquq?q qEqvqeqnq qsqiqnqnqeqrqsq
qlqoqvqeq qtqhqoqsqeq qwqhqoq qlqoqvqeq qtqhqeqmq.q qAqnqdq qiqfq qyqoquq
qdqoq qgqoqoqdq qtqoq qtqhqoqsqeq qwqhqoq qaqrqeq qgqoqoqdq qtqoq qyqoquq,q
qwqhqaqtq qcqrqeqdqiqtq qiqsq qtqhqaqtq qtqoq qyqoquq?q qEqvqeqnq
qsqiqnqnqeqrqsq qdqoq qtqhqaqtq.q"

Boris Zbarsky

unread,
May 28, 2013, 12:26:51 PM5/28/13
to mozilla-...@lists.mozilla.org
On 5/27/13 2:25 PM, Josh Matthews wrote:
> The following script (test_hammer_layout.html) can now run in Servo

> This yields 1239493.

That's nanoseconds per iteration. As in, 1.2ms (!). This is not really
ok. ;)

Is this with builds that do the "eagerly kick off layout from any DOM
change" bit? I really do think that we should not be doing that: people
batch up lots of DOM changes together, so doing layout from every change
is almost certainly not useful...

-Boris

Boris Zbarsky

unread,
May 28, 2013, 12:27:21 PM5/28/13
to mozilla-...@lists.mozilla.org
On 5/27/13 9:19 PM, Robert O'Callahan wrote:
> I'm pretty sure that Gecko short-circuits setting of an attribute to the
> value it already has, in the DOM code.

And the spec requires that behavior, fwiw, in various ways.

-Boris

Josh Matthews

unread,
May 28, 2013, 12:36:27 PM5/28/13
to mozilla-...@lists.mozilla.org
I agree completely. We'll need to spend some time figuring out what kind
of batching behaviour we want, but the test right now has been useful to
expose what seems to be an architectural problem, possibly due to the
current scheduler. My investigation in
https://github.com/mozilla/servo/issues/487 digs into this, and I'm keen
to try the same test on top of Brian's work now.
0 new messages