aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2023-07-13 01:51:16 +0000
committerstephan <stephan@noemail.net>2023-07-13 01:51:16 +0000
commit5da49ff5629c3e598a71081ab45d1bef79926f4b (patch)
tree2602c9a483d475c01d123755170ac715440c662b /ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
parenta5512fb17910ca7369fb93302cf92bafdcead360 (diff)
downloadsqlite-5da49ff5629c3e598a71081ab45d1bef79926f4b.tar.gz
sqlite-5da49ff5629c3e598a71081ab45d1bef79926f4b.zip
JS: change the default OPFS VFS journal mode from PERSIST to DELETE, as DELETE is faster in current browsers.
FossilOrigin-Name: a061a43e36b8f3cb7c465fd2e54cfcd9dceb07e232ee78602bbdd1818acd05ea
Diffstat (limited to 'ext/wasm/api/sqlite3-vfs-opfs.c-pp.js')
-rw-r--r--ext/wasm/api/sqlite3-vfs-opfs.c-pp.js25
1 files changed, 15 insertions, 10 deletions
diff --git a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
index 07dfa0f96..31099c7ce 100644
--- a/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
+++ b/ext/wasm/api/sqlite3-vfs-opfs.c-pp.js
@@ -298,6 +298,7 @@ const installOpfsVfs = function callee(options){
lock contention to free up.
*/
state.asyncIdleWaitTime = 150;
+
/**
Whether the async counterpart should log exceptions to
the serialization channel. That produces a great deal of
@@ -1089,7 +1090,7 @@ const installOpfsVfs = function callee(options){
propagate any exception on error, rather than returning false.
*/
opfsUtil.unlink = async function(fsEntryName, recursive = false,
- throwOnError = false){
+ throwOnError = false){
try {
const [hDir, filenamePart] =
await opfsUtil.getDirForFilename(fsEntryName, false);
@@ -1186,19 +1187,23 @@ const installOpfsVfs = function callee(options){
contention. */
sqlite3.capi.sqlite3_busy_timeout(oo1Db, 10000);
sqlite3.capi.sqlite3_exec(oo1Db, [
- /* Truncate journal mode is faster than delete for
- this vfs, per speedtest1. That gap seems to have closed with
- Chrome version 108 or 109, but "persist" is very roughly 5-6%
- faster than truncate in initial tests.
+ /* As of July 2023, the PERSIST journal mode on OPFS is
+ somewhat slower than DELETE or TRUNCATE (it was faster
+ before Chrome version 108 or 109). TRUNCATE and DELETE
+ have very similar performance on OPFS.
- For later analysis: Roy Hashimoto notes that TRUNCATE
- and PERSIST modes may decrease OPFS concurrency because
- multiple connections can open the journal file in those
- modes:
+ Roy Hashimoto notes that TRUNCATE and PERSIST modes may
+ decrease OPFS concurrency because multiple connections
+ can open the journal file in those modes:
https://github.com/rhashimoto/wa-sqlite/issues/68
+
+ Given that, and the fact that testing has not revealed
+ any appreciable difference between performance of
+ TRUNCATE and DELETE modes on OPFS, we currently (as of
+ 2023-07-13) default to DELETE mode.
*/
- "pragma journal_mode=persist;",
+ "pragma journal_mode=DELETE;",
/*
This vfs benefits hugely from cache on moderate/large
speedtest1 --size 50 and --size 100 workloads. We