Closed Bug 607242 Opened 9 years ago Closed 9 years ago

TM: inline js_Array_dense_setelem_hole

Categories

(Core :: JavaScript Engine, defect)

x86
macOS
defect
Not set

Tracking

()

RESOLVED FIXED

People

(Reporter: njn, Assigned: njn)

References

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file)

(Gal, this is a small patch that gives nice wins for Kraken.)


Bug 580752 greatly improved the tracer's handling of SETELEM.  In that bug I was faced with a decision:  whether to inline js_Array_dense_setelem_hole or not.  I chose not to.  The factors involved with having it as a separate function are as follows:

Pros:
+ Less LIR, so faster compile times
+ Less LIR, so LIR dumps are easier to read

Cons:
- Slower for code that overwrites holes

For SunSpider the perf difference was negligible.  But for Kraken inlining is a significant win (see instruction counts below).  So this patches changes the behaviour.

Nb: there's a "njn" comment in stobj_set_private_uint32() -- any suggestion about that would be welcome.  I think it's ok to only write the bottom 4 bytes of the private slot because that's the only part we should be reading, but it still makes me a bit nervous leaving the top 4 bytes effectively undefined.

---------------------------------------------------------------
| millions of instructions executed                           |
| total                        | on-trace (may overestimate)  |
---------------------------------------------------------------
|  4557.448  4557.448 (------) |  4285.926  4285.926 (------) | ai-astar
|  3056.474  2920.863 (1.046x) |  1460.124  1418.814 (1.029x) | audio-beat-det
|  1333.587  1305.399 (1.022x) |  1134.528  1140.630 (0.995x) | audio-dft
|  2803.999  2664.401 (1.052x) |  1412.105  1367.010 (1.033x) | audio-fft
|  2784.999  2674.743 (1.041x) |  1852.080  1868.552 (0.991x) | audio-oscillat
|  8522.039  8522.307 (------) |  5205.381  5205.511 (------) | imaging-gaussi
|  3096.051  3083.712 (1.004x) |   758.634   745.557 (1.018x) | imaging-darkro
|  5933.810  5763.817 (1.029x) |  4003.765  3833.638 (1.044x) | imaging-desatu
|   677.208   677.208 (------) |    10.149    10.149 (------) | json-parse-fin
|   489.734   489.734 (------) |     5.847     5.847 (------) | json-stringify
|  1293.116  1289.959 (1.002x) |   782.034   781.967 (------) | stanford-crypt
|   745.900   747.018 (0.999x) |   389.200   389.218 (------) | stanford-crypt
|  1157.544  1151.849 (1.005x) |   591.945   585.057 (1.012x) | stanford-crypt
|   506.818   507.011 (------) |   201.611   199.783 (1.009x) | stanford-crypt
-------
| 36958.734 36355.476 (1.017x) | 22093.337 21837.665 (1.012x) | all


Only problem is that when I time on my MacBook Pro I get nice speed-ups like you'd expect, except for imaging-desaturate which is 1.8x--2.2x *slower* when I run all of Kraken.  (This is with the shell.)  But if I just run imaging-desaturate by itself it's about 1.05x faster.  Maybe a GC issue?
Attachment #485993 - Flags: review?(gal)
Attachment #485993 - Flags: review?(gal) → review+
http://hg.mozilla.org/tracemonkey/rev/71c0268fb372
Whiteboard: fixed-in-tracemonkey
http://hg.mozilla.org/mozilla-central/rev/71c0268fb372
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.