New issue
Advanced search Search tips

Issue 879099 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 2
Type: Bug



Sign in to add a comment

JSC nearly 100x faster than V8 at String + string operator

Reported by nicksha...@gmail.com, Aug 30

Issue description

UserAgent: 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.
 
My results, including Firefox.
Screen Shot 2018-08-30 at 11.20.43.png
203 KB View Download
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.
Labels: Needs-Triage-M68
Cc: phanindra.mandapaka@chromium.org
Labels: Needs-Feedback Triaged-ET
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...!

70.0.3537.0.png
102 KB View Download
69.0.3497.57- beta.png
101 KB View Download
68.0.3440.106.png
103 KB View Download
M-60.png
97.4 KB View Download
Components: -Blink Blink>JavaScript
@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.
Screen Shot 2018-09-11 at 16.23.44.png
238 KB View Download
Project Member

Comment 7 by sheriffbot@chromium.org, Sep 11

Labels: -Needs-Feedback
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
Sorry, I meant "worse numbers for the middle test, and comparable numbers for the bottom two."
Owner: jarin@chromium.org
Status: Assigned (was: Unconfirmed)
to Jarin@ to confirm, but I suspect woxxom's analysis is correct.

Sign in to add a comment