Js1k demo (https://js1k.com/2015-hypetrain/demo/2287 ) is very slow
Categories
(Core :: SVG, enhancement)
Tracking
()
Tracking | Status | |
---|---|---|
firefox111 | --- | fixed |
People
(Reporter: mayankleoboy1, Assigned: jfkthame)
References
Details
Attachments
(1 file)
Assignee | ||
Comment 1•1 year ago
|
||
The profile here is dominated by FlattenedPath::ComputePointAtLength, which is getting called repeatedly to position each glyph along the path. With a long path, this gets really expensive as we iterate through the path operations from the beginning each time.
It looks like we could significantly improve the performance here with a simple "cursor" in FlattenedPath, so that when iterating forwards to position each glyph, we continue from the previous position instead of starting over.
Assignee | ||
Comment 2•1 year ago
|
||
This enables my local build to achieve 60fps on the js1k demo linked from the bug,
whereas without the patch I get barely 10fps.
Note: it's still possible for ComputePointAtLength would perform poorly if
the caller is iterating backwards or doing random access to a long path.
A potential mitigation for that would be to add an mLength field to FlatPathOp,
storing the length-so-far of the path, so that ComputePointAtLength could do
a binary search instead of linear accumulation. But this would add significant
memory overhead, and may not be worth doing; the low-overhead cursor here
appears to be enough to make text-on-a-path perform much better.
Updated•1 year ago
|
Reporter | ||
Comment 3•1 year ago
|
||
bug 1801307 appears to be using an analogous approach in gpu-canvas.
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/100b45bcf622 Use a cursor in FlattenedPath to accelerate successive calls to ComputePointAtLength for SVG text-on-a-path layout. r=gfx-reviewers,nical
Comment 5•1 year ago
|
||
bugherder |
Reporter | ||
Comment 6•1 year ago
|
||
This is much better now : https://share.firefox.dev/3lcNOiI
Thanks very much for the fix!
Updated•1 year ago
|
Description
•