JSC nearly 100x faster than V8 at String + string operator
Reported by
nicksha...@gmail.com,
Aug 30
|
||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15 Steps to reproduce the problem: 1. Go to https://jsperf.com/string-object-conversion-to-primitive 2. Run test in Safari 3. Run test in Chrome What is the expected behavior? Similar performance across both. What went wrong? In my testing, Safari is 97x faster at the "Object plus empty string", and "Empty string plus object" tests, and is over twice as fast at the "String()" test. Did this work before? N/A Chrome version: 68.0.3440.106 Channel: stable OS Version: OS X 10.11.6 Flash Version: lol I was testing conversion to a primitive, so I only tested addition to/of the empty string. This might be special-cased in JSC.
,
Aug 30
These numbers suggest JSC simply drops the entire loop body which looks like while(i153562968510039--){obj + '';} I think a more realistic benchmark is needed here that makes sure the result is actually used in the loop (and afterwards!) to eliminate the possibility of elimination.
,
Aug 30
,
Aug 31
nickshanks@ Thanks for filling the issue... Tried to this issue on reported chrome 68.0.3440.106 using Mac 10.13.6. Attaching screenshot for reference. Steps: ----- 1. Launched reported chrome 2. Navigated to given URL " https://jsperf.com/string-object-conversion-to-primitive " 3. Clicked on Run Test As we are seen different values @reporter: Can you please check the attached values of chrome different versions attached the same and confirm the issue and also provide the actual and expected values for better triaging it. Could you please upgrade to latest chrome beta 69.0.3497.57 (is rolled out very soon as stable), you can download latest chrome builds here:" https://www.chromium.org/getting-involved/dev-channel ". Thanks...!
,
Sep 5
,
Sep 11
@phanindra.mandapaka All of the screenshots you provided are of Chrome. I've just tested Canary 71.0.3549.0 and got results in line with yours and my original report. The difference I am trying to highlight is that, on the same hardware when run a few minutes apart, Safari gets much better numbers for the top two tests, comparable numbers for the middle test, and worse numbers for the bottom two. @woxxom might be closer to the mark as regards JSC's possible elimination of degenerate code. Either way (optimised `+` operator or code elimination) the same JS runs faster in Safari.
,
Sep 11
Thank you for providing more feedback. Adding the requester to the cc list. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Sep 11
Sorry, I meant "worse numbers for the middle test, and comparable numbers for the bottom two."
,
Sep 13
to Jarin@ to confirm, but I suspect woxxom's analysis is correct. |
||||||
►
Sign in to add a comment |
||||||
Comment 1 by nicksha...@gmail.com
, Aug 30203 KB
203 KB View Download