Open Bug 951052 Opened 11 years ago Updated 5 months ago

Improve performance on hixie's element insertion microbenchmark on Android

Categories

(Core :: DOM: Core & HTML, defect)

ARM
Android
defect

Tracking

()

Performance Impact none

People

(Reporter: salar2k, Unassigned)

References

()

Details

DOM operations are very slow in android platform. Here are some test results according to Hixie's performance test: http://nontroppo.org/timer/Hixie_DOM.html Tested on HTC Desire C with Cpu Snapdragon 600MH Android version 4.0.3 Firefox for Android 26.0: 5711ms Google Chrome 31: 827ms Opera for Android 16.0: 948ms
Component: General → DOM
Product: Firefox for Android → Core
Version: unspecified → Trunk
Seems likely to be a timer resolution problem or a JIT problem to me.
Actually, this particular microbenchmark is probably just slow because of the way that we represent child lists as an array. This benchmark exercises the worst-case behavior of this representation: it inserts tens of thousands of elements, one at a time, at the beginning of the list. The result is that we spend all of our time in memmove, and if the platform has slow memory (which I bet the HTC desire does), that will really hurt. I would be interested in the actual subtest results, not just the overall time, that you see on the HTC desire to verify that hypothesis. If this is indeed what's going on, then this is not a terribly high priority, because this is not a common access pattern in real websites (for example real websites pretty much never have child lists this long). And the right fix in this case is bug 651120. Note also that the canonical home for this benchmark is http://www.hixie.ch/tests/adhoc/perf/dom/artificial/core/001.html
Depends on: 651120
Summary: Improve DOM performance in Android platform → Improve performance on hixie's element insertion microbenchmark
Flags: needinfo?(salar2k)
The results was with newly opened firefox; they're worse with recently closed tabs. Total elapsed time: 7069ms Breakdown (fraction shows time relative to append time): Append: 1.00; 1171ms Prepend: 2.44; 2855ms Index: 0.03; 37ms Insert: 1.77; 2069ms Remove: 0.80; 937ms
Flags: needinfo?(salar2k)
OK, but what are the corresponding numbers for Chrome on the same hardware?
Sorry, my bad. Chrome 31: Total elapsed time: 938ms Breakdown (fraction shows time relative to append time): Append: 1.00; 284ms Prepend: 0.89; 253ms Index: 0.15; 43ms Insert: 0.88; 250ms Remove: 0.38; 108ms Opera 16: Total elapsed time: 924ms Breakdown (fraction shows time relative to append time): Append: 1.00; 228ms Prepend: 1.12; 256ms Index: 0.20; 46ms Insert: 1.18; 268ms Remove: 0.55; 126ms Puffin Browser 3.0.10154M Total elapsed time: 2654ms Breakdown (fraction shows time relative to append time): Append: 1.00; 11ms Prepend: 1.00; 11ms Index: 0.73; 8ms Insert: 1.73; 19ms Remove: 236.82; 2605ms
OK. So it's worth looking at the difference in the "Append" case, for sure. And "Puffin Browser" seems to have a broken date implementation or something... Mark, is it possible to get a profile of this thing on Android?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Flags: needinfo?(mark.finkle)
Summary: Improve performance on hixie's element insertion microbenchmark → Improve performance on hixie's element insertion microbenchmark on Android
(In reply to Boris Zbarsky [:bz] (Vacation Dec 19 to Jan 1) from comment #6) > OK. So it's worth looking at the difference in the "Append" case, for sure. > And "Puffin Browser" seems to have a broken date implementation or > something... > > Mark, is it possible to get a profile of this thing on Android? I managed to get a profile: http://people.mozilla.org/~bgirard/cleopatra/#report=97cbad39df2fc52fac2c4464183a5fe61bd3e866 The test() call starts at: Startup::XRE_Main > Timer::Fire > js::RunScript
Flags: needinfo?(mark.finkle)
That profile is from a Nexus 4 running Android 4.4.2
Hrm. That profile shows 7% of the time is spent under testAppend(), but the actual leaves under there don't seem to show any obvious hotspots and the self time is 0. Contrast with testInsert, which clearly shows a hotspot in bcopy... though only for half the total time(!). Why do we have calls out to java_org_mozilla_gecko_gfx_NativePanZoomController_getRedrwaHint under testAppend?
(In reply to Vacation Dec 19 to Jan 1 from comment #9) > Hrm. That profile shows 7% of the time is spent under testAppend(), but the > actual leaves under there don't seem to show any obvious hotspots and the > self time is 0. > > Contrast with testInsert, which clearly shows a hotspot in bcopy... though > only for half the total time(!). > > Why do we have calls out to > java_org_mozilla_gecko_gfx_NativePanZoomController_getRedrwaHint under > testAppend? I really don't know, but looking at the code, we _might_ bet getting into NativePanZoomController_getRedrawHint from a geometryChanged call. Maybe the changes in the DOM are being seen as a screen size change? http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/gfx/GeckoLayerClient.java#730 calls http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/gfx/GeckoLayerClient.java#177 Do we have a bug filed on this performance issue for Desktop Firefox? I see significant differences between desktop Firefox (~230ms total) and Chrome (~40ms total).
Kats - Any idea on the NativePanZoomController_getRedrawHint question?
Flags: needinfo?(bugmail.mozilla)
Uh, I can see no reason whatsoever that function should be getting called. At all. That code is disabled on Fennec. I can only assume this is a symbolication error of some sort. BenWa?
Flags: needinfo?(bugmail.mozilla) → needinfo?(bgirard)
(In reply to Mark Finkle (:mfinkle) from comment #10) > I really don't know, but looking at the code, we _might_ bet getting into > NativePanZoomController_getRedrawHint from a geometryChanged call. Maybe the > changes in the DOM are being seen as a screen size change? > > http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/gfx/ > GeckoLayerClient.java#730 > calls > http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/gfx/ > GeckoLayerClient.java#177 > (Note that on Fennec we are still using the JavaPanZoomController, not the NativePanZoomController, so the call at line 177 above should hit http://mxr.mozilla.org/mozilla-central/source/mobile/android/base/gfx/JavaPanZoomController.java#1308)
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #12) > Uh, I can see no reason whatsoever that function should be getting called. > At all. That code is disabled on Fennec. I can only assume this is a > symbolication error of some sort. BenWa? Yes it is, it a bad interaction with elfhack and the profiler. We had profiler working on elfhack binaries at some point but it looks like we regressed. We could profile again with a non elfhack binary to get better symbol. The current poorly symbolicate profile doesn't show a hotspot but a properly symbolicate profile *might*.
Flags: needinfo?(bgirard)
> Do we have a bug filed on this performance issue for Desktop Firefox? Yes, bug 651120. The thing this bug depends on. Again, I'm only really interested in the append part of this test; poor performance on the remove/insert/prepend bits is expected.
> Do we have a bug filed on this performance issue for Desktop Firefox? https://bugzilla.mozilla.org/show_bug.cgi?id=606503 https://bugzilla.mozilla.org/show_bug.cgi?id=606474
Bug 606503 is a bug in an add-on, not in Desktop Firefox.
Any news on this? Using Firefox 29 have same results.
*has :D
It is Firefox 33 and still no one is interested in having a deep look? The results are the same.
Firefox 35 on BlueStacks emulator: Total elapsed time: 3240ms Breakdown (fraction shows time relative to append time): Append: 1.00; 490ms Prepend: 2.39; 1170ms Index: 0.06; 30ms Insert: 2.04; 1000ms Remove: 1.12; 550ms Android 4.4.2 browser on BlueStacks emulator: Total elapsed time: 90ms Breakdown (fraction shows time relative to append time): Append: 1.00; 50ms Prepend: 0.20; 10ms Index: 0.00; 0ms Insert: 0.60; 30ms Remove: 0.00; 0ms I thing one of the reasons Firefox feels a little slower on Android is the DOM operations. Please someone pay more attention to this.
https://bugzilla.mozilla.org/show_bug.cgi?id=1472046 Move all DOM bugs that haven’t been updated in more than 3 years and has no one currently assigned to P5. If you have questions, please contact :mdaly.
Priority: -- → P5
On Android we're still a bit slower. On Linux Nightly seems to be faster than Chrome.
Component: DOM → DOM: Core & HTML
Severity: major → S3
Performance Impact: --- → ?
Priority: P5 → --

The Performance Impact Calculator has determined this bug's performance impact to be none. If you'd like to request re-triage, you can reset the Performance Impact flag to "?" or needinfo the triage sheriff.

Platforms: Android
Websites affected: Rare

Performance Impact: ? → none
You need to log in before you can comment on or make changes to this bug.