Run StructuredDeserialize lazily
Categories
(Core :: DOM: postMessage, enhancement)
Tracking
()
People
(Reporter: surma, Unassigned)
References
(Blocks 1 open bug)
Details
User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36
Steps to reproduce:
- Send a big message from a worker to the main thread using
postMessage()
- Measure the time it takes to access the
MessageEvent
’s.data
property
Demo: https://postmessage-benchybench.glitch.me/lazy-deserialize.html
Code: https://glitch.com/edit/#!/postmessage-benchybench?path=lazy-deserialize.html
Actual results:
It takes almost no time.
Expected results:
It should take some time (I’m seeing between 20 and 40ms on a MacBook Pro). Chrome and Safari seem to run StructuredDeserialize1 lazily, so only once .data is being accessed.
I think this is desirable as it puts the developer in control when to pay the performance hit of deserializing potentially big payloads. It also aligns Firefox with Chrome and Safari.
Comment 1•4 years ago
|
||
I tested this on Mac OS X 10.14 with FF Release 68 and Nightly 70.0a1(2019-07-14) and I have the same result like the one from the reporter. I'm not sure if this should be marked as an enhancement or a defect, for the moment I will mark it as an enhancement but please feel free to change it if you consider it necessary.
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•4 years ago
|
Updated•1 year ago
|
Description
•