Open Bug 763119 Opened 12 years ago Updated 2 years ago

OS X canvas text performance is worse than Safari

Categories

(Core :: Graphics, defect)

x86
macOS
defect

Tracking

()

People

(Reporter: jrmuizel, Assigned: jrmuizel)

References

Details

Attachments

(4 files)

On the following test page:
http://jsperf.com/canvas-2d-filltext-performance/2

We get 42,199 Safari and Chrome both get 143,102

There should be some easyish things that should get us at least a little better.
Assignee: nobody → jmuizelaar
Both this profile and bug 762710#c3 suggest that the telemetry calls in gfxFont::GetShapedWord are much too expensive. I think we need to substantially simplify (or even completely eliminate) the telemetry here.
(In reply to Jonathan Kew (:jfkthame) from comment #3)
> Both this profile and bug 762710#c3 suggest that the telemetry calls in
> gfxFont::GetShapedWord are much too expensive. I think we need to
> substantially simplify (or even completely eliminate) the telemetry here.

Interestingly, I didn't see that stuff showing up when profiling with instruments.
Depends on: 762710
(In reply to Jonathan Kew (:jfkthame) from comment #3)
> Both this profile and bug 762710#c3 suggest that the telemetry calls in
> gfxFont::GetShapedWord are much too expensive. I think we need to
> substantially simplify (or even completely eliminate) the telemetry here.

Um, the problem here is the text run code is 3x slower than Chrome/Safari.  Removing the problem with Histogram::Add still leaves us 3x slower.  Given that the test is iterating with the same string and font style, which should be cached, our perf with real usage patterns is probably actually worse compared to Safari/Chrome.
Another thing to note is that our relative perf is *much* worse on Windows.  Using a test that varies the string drawn each time and draws it into the viewport (rather than off-viewport for the most part), I get the results below.

http://people.mozilla.org/~jdaggett/tests/canvastext-timing.html

fillText ops per second (Win7):

Chrome 21 dev     119,646
IE9                30,190
Nightly (6/10/12)   5,515
Safari/Chrome don't do it so we probably shouldn't either.
With all of the patches I've posted we now spend more time in SetText() than DrawText() (29% vs 28%)
I should also point out here that this isn't a strictly an apples to apples comparison, since we have a single, unified text rendering path while Webkit has a fast-path mode and a significantly slower complex text path.

Default path:

  http://localhost/~jd/tests/canvastext-timing.html

  Nightly:  16,131 ops/sec  (== 0.36x Chrome)
  Chrome21: 45,405 ops/sec

With 'text-rendering: optimizeLegibility' set on the canvas element:

  http://localhost/~jd/tests/canvastext-timing-text-rendering.html

  Nightly:  16,131 ops/sec  (== 1.75x Chrome)
  Chrome21:  9,206 ops/sec

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

Attachment

General

Created:
Updated:
Size: