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.

On 05/27/2013 04:18 PM, Patrick Walton wrote:
So I guess the problem is that setAttribute() is slow?

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

On 05/27/2013 03:45 PM, Josh Matthews wrote:
On 05/27/2013 02:25 PM, Josh Matthews wrote:
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

For the sake of contrast, a current Firefox nightly shows me 1319.

And interestingly enough, the same test with the
div.getBoundingClientRect call removed yields a marginally better
1162253.
_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo

_______________________________________________
dev-servo mailing list
dev-servo@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-servo

Reply via email to