Closed
Bug 850185
Opened 12 years ago
Closed 2 months ago
[Workers] postMessage is sometimes slower than JSON.stringify
Categories
(Core :: DOM: Workers, enhancement, P3)
Core
DOM: Workers
Tracking
()
RESOLVED
WORKSFORME
People
(Reporter: Yoric, Unassigned)
References
(Blocks 1 open bug)
Details
(Whiteboard: dom-lws-bugdash-triage)
While attempting to improve bug 850184, I have run a few benchmarks on JSON.stringify + TextEncode vs postMessage for huge JSON objects. Some of the results are surprising. As it turns out, in my test case, JSON.stringify is faster than postMessage. I suspect that this is not expected.
I don't understand what you're trying to compare here. postMessage sends stuff to a different thread, JSON.stringify doesn't, no?
Reporter | ||
Comment 2•12 years ago
|
||
Yes, I was just surprised because I expect that, for a huge object, the cost of serialization in postMessage dominates any other cost cost. If my understanding is correct, I am therefore comparing two serialization mechanisms: postMessage's and JSON.stringify. Given that JSON.stringify is anything but optimal, I expected postMessage's algorithm to be quite faster.
Well we haven't really tried to optimize structured cloning. A profile would be useful here.
Updated•7 years ago
|
Priority: -- → P3
Comment 4•7 years ago
|
||
Worth investigating in the future.
Updated•2 years ago
|
Severity: normal → S3
Comment 5•2 months ago
|
||
I think we've seen some nice improvements to serialization performance in the past decade but to comment 1's point we also fundamentally are doing a very different thing, in particular, we do expect JSON stringify performance to do better with large strings where ropes can be used, etc. (We've also seen JSON stringify performance concerns from objects with a lot of keys/values.)
Status: NEW → RESOLVED
Type: defect → enhancement
Closed: 2 months ago
Resolution: --- → WORKSFORME
Whiteboard: dom-lws-bugdash-triage
You need to log in
before you can comment on or make changes to this bug.
Description
•