diff options
author | stephan <stephan@noemail.net> | 2022-11-10 13:14:30 +0000 |
---|---|---|
committer | stephan <stephan@noemail.net> | 2022-11-10 13:14:30 +0000 |
commit | da2641597a401b2a6c19dc6ee860f9f25ec1581b (patch) | |
tree | 599101020b2ab371224727645fa18fd30e0d208f /ext/wasm/api/sqlite3-api-opfs.js | |
parent | aafa022f5b5371d83ee3478c17e0c7f2faf1ce62 (diff) | |
download | sqlite-da2641597a401b2a6c19dc6ee860f9f25ec1581b.tar.gz sqlite-da2641597a401b2a6c19dc6ee860f9f25ec1581b.zip |
Rework automatically acquired OPFS locks to be released during idle time. This eliminates the performance hit reported in [46304ba057707c].
FossilOrigin-Name: a7fe91afca473fe55c983bc81d214df4ef3699863c7423fa4b6b9cde23d6a3b4
Diffstat (limited to 'ext/wasm/api/sqlite3-api-opfs.js')
-rw-r--r-- | ext/wasm/api/sqlite3-api-opfs.js | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/ext/wasm/api/sqlite3-api-opfs.js b/ext/wasm/api/sqlite3-api-opfs.js index 86285df1d..da5496f65 100644 --- a/ext/wasm/api/sqlite3-api-opfs.js +++ b/ext/wasm/api/sqlite3-api-opfs.js @@ -467,9 +467,11 @@ const installOpfsVfs = function callee(options){ /** Returns an array of the deserialized state stored by the most recent serialize() operation (from from this thread or the - counterpart thread), or null if the serialization buffer is empty. + counterpart thread), or null if the serialization buffer is + empty. If passed a truthy argument, the serialization buffer + is cleared after deserialization. */ - state.s11n.deserialize = function(){ + state.s11n.deserialize = function(clear=false){ ++metrics.s11n.deserialize.count; const t = performance.now(); const argc = viewU8[0]; @@ -494,6 +496,7 @@ const installOpfsVfs = function callee(options){ rc.push(v); } } + if(clear) viewU8[0] = 0; //log("deserialize:",argc, rc); metrics.s11n.deserialize.time += performance.now() - t; return rc; |