Open Bug 966798 Opened 12 years ago Updated 4 years ago

DOM Benchmark exposes horrible HTML table display performance

Categories

(Core :: Layout, defect, P4)

26 Branch
defect

Tracking

()

People

(Reporter: phi2x, Unassigned)

Details

(Keywords: perf, testcase)

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:26.0) Gecko/20100101 Firefox/26.0 (Beta/Release) Build ID: 20131205075310 Steps to reproduce: Try the DOM benchmark found here: http://cpcbox.com/dombench.htm Actual results: Performance is currently abysmal in Firefox: only a few updates per second, on a desktop computer from 2014. Expected results: Google Chrome is about twice faster, which is at tleast better than nothing. But I presume performance could be 10x faster. And it should, because web apps need this kind of performance. Let's take for example the use case of an online hex editor: to scroll on the contents of a big file, browsers need to refresh a table of hex bytes at 60fps to play on the same field as native hex editors.
I get the following numbers using a fresh profile: Firefox 26.0: 132-135ms Firefox 29.0 2014-02-02: 115-130ms Chrome 34.0.1809.0: 119-120ms So Nightly has a fair amount of variance compared to the others, but it's more or less on par with Chrome, and even 26 isn't far behind. Still might be worth profiling to see if anything stands out, of course.
On Nightly I see 200ms and on Chrome 32 I see 150ms. (Win 7)
Some numbers, just for reference, on my hardware: Original testcase: ~180ms/frame Original testcase with table visibility:hidden: ~110ms/frame Original testcase with table display:none: ~8ms/frame So this is in fact all slowness in layout/painting, not in the DOM implementation itself. A profile bears this out: 14% of the time is spent creating CSS boxes 28% doing relayout of the table 31% painting (mostly drawText) 18% under SetTextContent, of which 2/3 is the frame destruction from ContentRemoved. I get a slight speedup to maybe ~170ms/frame if I in fact give the table a fixed width, so it's actually using fixed layout, not auto layout. If I change this line in the testcase: domTable.rows[row].cells[col].textContent = mem[idx]; to domTable.rows[row].cells[col].firstChild.data = mem[idx]; so that we're not creating new textnodes all the time, that drops the times from ~180ms to ~120ms. At that point it's 6% DOM updates, 45% relayout, 45% painting. > to scroll on the contents of a big file, browsers need to refresh a table of hex bytes > at 60fps The right way to do that is to prerender tiles before/after the viewport and just blit when you scroll, while at the same time rendering new still-off-the-viewport tiles... Or in the case of browsers us the built-in scrolling facilities, which do pretty much that. :) Nice testcase, by the way!
Status: UNCONFIRMED → NEW
Component: DOM: Core & HTML → Layout
Ever confirmed: true
Keywords: perf, testcase
OS: Windows 7 → All
Priority: -- → P4
Hardware: x86_64 → All
The DOM Table benchmark can now be found at: http://cpcbox.com/snippets/ Here's the current test results on my computer: - In Chrome 44, the table is rendered in ~100ms - In Firefox 39, the table is rendered in ~1800ms Firefox 39 is ~18X slower than Chrome on this benchmark :(
The first one shows up very fast, the other ones takes a lot more, but this happens on both Firefox and Chrome. I don't know how Chrome is so fast for you. I get 1400ms on Chrome and 2100 on Firefox 39 and Nightly.
Running the benchmark on Firefox 40.0.2, the table now renders in ~230ms. I also updated my graphics card drivers, perhaps that explains this massive difference in performance. But it's still twice slower than Chrome.

Testcase is not available anymore.

Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.