Closed Bug 1349159 Opened 9 years ago Closed 1 year ago

JS engine slowness makes zooming in/out of SVG map of the US States less smooth than in Chrome

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

RESOLVED INCOMPLETE
Tracking Status
firefox55 --- affected

People

(Reporter: jwatt, Unassigned)

References

()

Details

(Keywords: perf, triage-deferred)

From bug 873425 comment 17. https://bl.ocks.org/mbostock/2206340 Zooming in and out (two finger scrolling/mouse wheel) is not so smooth in Firefox on my computer as it is in Chrome. The example doesn't implement zooming via a transform as you might expect. Instead it recalculates entirely new path data for a bunch of SVG <path> elements that are the outlines of each US State, setting the path data on the elements by calling setAttribute('d', ...). Profile: https://perfht.ml/2mPTc8k 7802 ms 100% under load 7200 ms 92% JS::Call 460 ms 6% setAttribute 474 ms 6% PresShell::Paint So we're spending most of our time evaluating JS, but only 6% of the total time is spent when the JS calls setAttribute() to set the path data. So in this case it looks like the slowness is simply the JavaScript engine being slower than Chrome's rather than the SVG path processing or painting being slow.
See Also: → 936472
Component: SVG → JavaScript Engine
That profile shows a bunch of time under fdlibm::asin -> fdlibm::sqrt, nursery GC, DoubleToString and math_sincos_impl. I'll take a look later this week.
Flags: needinfo?(jdemooij)
Can you still reproduce this with the latest Nightly? If I open this page on OS X, then start the Instruments profiler, then zoom in and out on the page, I see at least 15% of the time in painting/gfx code. There is definitely time in JS but not as bad as the numbers in comment 0.
Flags: needinfo?(jdemooij) → needinfo?(jwatt)
With the mac build from: https://ftp.mozilla.org/pub/firefox/nightly/2017/03/2017-03-23-03-02-03-mozilla-central/ and a new profile I get: https://perfht.ml/2mxSWyH 7633 ms 100% under load 6908 ms 90% JS::Call 468 ms 6% setAttribute 546 ms 7% PresShell::Paint FWIW to zoom I'm using two finger scrolling with very a short, but rapid, up-down motion (so I'm not zooming in/out far, just enough to keep the resize script working hard for the duration of the profile - only 73ms worth of stacks in that last profile contain mach_msg_trap).
Flags: needinfo?(jwatt)
I also have very poor SVG zooming performance with both Firefox 53 and 55 nightly, on Mac. The zooming gesture is the same as the scroll one (2 fingers slide). Tested on this page : https://bl.ocks.org/mbostock/4e3925cdc804db257a86fdef3a032a45 Profile : https://perfht.ml/2pEoSSy
Keywords: triage-deferred
Priority: -- → P3
Severity: normal → S3
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.