Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upfirstChild getter test runs 100x slower after first two runs #12979
Comments
|
Are those times in a clean tree? At first glance, looks like servo implements enough of the [Pure] annotation stuff to mark the getter as movable, but not eliminatable (that's #10991 and I have no clue why that wasn't done offhand). That means that in a clean tree, with that property marked [Pure], I would expect Ion to loop-hoist the get and the loop to just be timing the counter increment and loop condition. Which is certainly going to be sub-1ns per iteration on modern desktop hardware, and I consistently see that in Gecko on this testcase. What's harder to explain in that setup is the slowdown. Maybe see what the various Ion debug output looks like when you click that button for the third time? It's possible we're ending up recompiling the function for some reason and screwing it up or something... |
|
Oh, and if the times are with the [Pure] annotation removed, then I have no idea what's going on, sorry. |
|
Yes, those times are a clean tree. |
|
OK, so I think I understand pretty much all the goings on here. The pieces are:
OK, so we go to run our function, which has this body:
The first time the function runs, we enter the loop, baseline-compile the function, then ion-compile the function. At this point we have not done the The second time the function runs, we ion-compile the function again, find the nice baseline IC for the The third time we run the loop, we recompile it again (presumably due to the earlier bailout from the shape guard). This time we have failed a shape guard in the past, so the shape guard on |
|
I also have not been able to find an issue covering the global object properties. It's definitely known, since we've discussed it in the past, and we intend to fix it. |
|
Note also that "console" should not be a getter call to start with: see #13010 |
:( |
|
It did fix some slowness, yes. if you edit tests/html/bindings_perf.html to do a single "console" get sometime before With the "console" get happening for the first time at the end of the method, we still get a shape change on the global at that point due to
then the times I see logged in Gecko are:
That's what we're getting in servo as well, except In Gecko, |
|
OK, I looked at the latter issue at least. The difference between Gecko and servo there is in fact console being a namespace. This means that getting it does not seem to involve a shape guard or something (why, I dunno!). So we do reshape the window, but don't end up with shape guard failures as a result, so don't trigger https://bugzilla.mozilla.org/show_bug.cgi?id=1297604. If I modify IonBuilder.cpp to not output a shape guard on the holder in IonBuilder::testCommonGetterSetter then the problem goes away in servo too. If I modify the testcase to look like this:
at the end of the function (so that there is a shape guard for the parent get, and then console gets lazily resolved), the problem pops up in Gecko as well. So most immediately, fixing #13010 will help fix this somewhat for servo specifically, sorta kinda. But we really want to get traction on those spidermonkey issues too, I think. |
|
With console being a namespace:
Should we close this? :) |
|
Seems like it! |
To reproduce, run
./mach run tests/html/bindings_perf.htmland press themeasure firstChild getterbutton three times. The first two times, I consistently see sub-1ns measurements. Subsequently, I see 15-20ns measures. This is completely reproducible for me every time I run Servo.Testcase source
cc @bzbarsky any ideas what could cause this off the top of your head? The initial measurements are bizarrely fast; the subsequent ones are much more sensible.