Open
Bug 649646
Opened 13 years ago
Updated 2 years ago
IndexedDB: Modify structured clone byte stream directly instead of using JS on DB thread
Categories
(Core :: Storage: IndexedDB, task, P3)
Core
Storage: IndexedDB
Tracking
()
NEW
People
(Reporter: bent.mozilla, Unassigned)
Details
We currently deserialize, modify, and then reserialize structured clone data on the DB thread when adding to object stores that use inline keys and a key generator. In an effort to keep one runtime per thread we should just modify the data directly.
The basic use-case is something like this: When serializing, we have an object like: { foo: "bar", hello: { world: "fahrvergnugen" }, deep: {}, x: 2 } At a later point, we want to modify the object such that it looks like: { foo: "bar", hello: { world: "fahrvergnugen" }, deep: { cow: { id: 4 } }, x: 2 } In other words, we want to set the property "deep.cow.id" to 4 (and in the process create any objects that are missing). Another thing that might help is that the property being written is always a 64bit integer. And we know during the initial serialization where we'll want to write it. I.e. the name of the property that we want to set. The only thing we don't know is the actual value. One thing occurred to me though. We *could* actually implement this without any involvement of the structured clone code. What we could do is to store in the database the generated id, and store that separately from the serialized clone. Then when reading data from the database we'd parse the serialized value and then insert the generated id in the newly created JS object. And do that every time when reading data from the database. I'd likely not be as performant, but it'd get us off of using the runtime from the wrong thread.
Comment 2•13 years ago
|
||
(In reply to comment #1) > One thing occurred to me though. We *could* actually implement this without any > involvement of the structured clone code. What we could do is to store in the > database the generated id, and store that separately from the serialized clone. We already do this AFAIK. > Then when reading data from the database we'd parse the serialized value and > then insert the generated id in the newly created JS object. And do that every > time when reading data from the database. This shouldn't be too hard to do.
Component: DOM → DOM: IndexedDB
Version: Trunk → unspecified
Updated•6 years ago
|
Priority: -- → P5
Comment 3•5 years ago
|
||
Given some recent discussions with the JS team, it seems like we want to do this some time soon.
Priority: P5 → P3
Comment 4•5 years ago
|
||
To clarify, the following is the part that is interesting. It would allow using a single StructureSerialize when the spec currently involves two calls to this but avoid some of the existing complexity in trying to avoid the two copies. (In reply to Jonas Sicking (:sicking) No longer reading bugmail consistently from comment #1) > One thing occurred to me though. We *could* actually implement this without > any involvement of the structured clone code. What we could do is to store > in the database the generated id, and store that separately from the > serialized clone. > > Then when reading data from the database we'd parse the serialized value and > then insert the generated id in the newly created JS object. And do that > every time when reading data from the database.
Comment 5•5 years ago
|
||
I wonder if we can move compression/decompression to content processes once we fix this.
Updated•4 years ago
|
Assignee: bent.mozilla → nobody
Status: ASSIGNED → NEW
Comment 6•4 years ago
|
||
:janv, is this still something we would want to do?
Flags: needinfo?(jvarga)
Updated•4 years ago
|
Type: defect → task
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•