Closed Bug 1035170 Opened 10 years ago Closed 9 years ago

[meta] Move SWF parsing to script execution thread and make it as lazy as possible

Categories

(Firefox Graveyard :: Shumway, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: till, Assigned: till)

References

Details

(Keywords: perf, Whiteboard: [parser][memory usage][performance])

Attachments

(1 file)

mbx, tobytailor and me discussed ways to improve our startup speed and memory usage. While we reduced both quite considerably over the last two weeks, we can do something more fundamental:

Instead of deeply parsing every tag in a worker, we can load the SWF on the script execution thread, into a buffer that we give its final size as soon as we parsed the SWF's header and know how large it is decompressed.

Then, we just parse through the SWF shallowly, creating symbols that contain their binary representation as subarrays of the main buffer. For shapes and bytecode, we parse the binary representation once and then store it, because re-parsing them every time they're needed would be too costly (and impossible in the case of AVM2 bytecode, at least, I don't know about AVM1).

For frame data (i.e. PlaceObject, ShowFrame, etc), however, we can keep everything unparsed and just-in-time-parse the tags while playing back a timeline. This is true both for the main timeline and for the timelines of Sprite symbols.

We should track parts of this work in blocking bugs and treat this as a meta bug. Still, discussion about the general approach should happen here.
Till said he thinks this should be an M3 bug.
Blocks: shumway-m3
No longer blocks: shumway-m4
Keywords: perf
Assignee: nobody → schneider
Status: NEW → ASSIGNED
Tobias says this bug doesn't need to block M3.
Blocks: shumway-m4
No longer blocks: shumway-m3
The first part of this is done: parsing now always happens on the main thread, and the parsing thread is no more. This already reduces memory churn substantially, but more importantly, it lays the foundation for much more substantial wins.
Assignee: schneider → till
And blocking m3 again, reflecting the fact that we want to also substantially improve startup performance for that milestone.
Blocks: shumway-m3
No longer blocks: shumway-m4
Blocks: 1096807
Fixed by https://github.com/mozilla/shumway/pull/1856, with very nice results both for startup speed and memory usage.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Depends on: 1108869
Product: Firefox → Firefox Graveyard
You need to log in before you can comment on or make changes to this bug.