1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-07-29 08:01:23 +03:00

Make use of the --big-transactions flag in the speedtest1 JS apps.

FossilOrigin-Name: f2846dcbcaac7880394fb14597c3a60ed310419128c4c5b863cd771a7e5cdeb5
This commit is contained in:
stephan
2022-09-08 21:33:50 +00:00
parent e07ce18be5
commit dd628ed58b
4 changed files with 48 additions and 33 deletions

View File

@ -176,6 +176,7 @@
controls and some of them make little sense here
(e.g. --script FILE). */
flags["autovacuum"] = "Enable AUTOVACUUM mode";
flags["big-transactions"] = "Important for tests 410 and 510!";
//flags["cachesize"] = "N Set the cache size to N";
flags["checkpoint"] = "Run PRAGMA wal_checkpoint after each test case";
flags["exclusive"] = "Enable locking_mode=EXCLUSIVE";
@ -221,8 +222,9 @@
flags["verify"] = "Run additional verification steps.";
flags["without"] = "rowid Use WITHOUT ROWID where appropriate";
const preselectedFlags = [
'singlethread',
'memdb'
'big-transactions',
'memdb',
'singlethread'
];
Object.keys(flags).sort().forEach(function(f){
const opt = document.createElement('option');
@ -317,7 +319,7 @@
case 'error': logErr(msg.data); break;
case 'load-status': updateLoadStatus(msg.data); break;
default:
logErr("Unhandled worker message type:",arguments[0]);
logErr("Unhandled worker message type:",msg);
break;
}
};

View File

@ -29,9 +29,15 @@
block the UI until it finishes! Adding UI controls to manually configure and start it
are TODO.</div>
<div>Output is sent to the dev console because we cannot update the UI while the
speedtest is running unless/until we move the speedtest to a worker thread.</div>
speedtest is running unless/until we move the speedtest to a worker thread.
</div>
<div class='warning'>Achtung: running it with the dev tools open <em>drastically</em>
slows it down: by a factor of 2.5+. For faster results, keep the dev tools closed
when running it!
</div>
<hr>
<div id='test-output'></div>
<div id='test-output'>
</div>
<script src="common/whwasmutil.js"></script>
<script src="common/SqliteTestUtil.js"></script>
<script src="speedtest1.js"></script>
@ -65,7 +71,7 @@
opfsDir._ = undefined;
const eOut = document.querySelector('#test-output');
const log2 = async function(cssClass,...args){
const log2 = function(cssClass,...args){
const ln = document.createElement('div');
if(cssClass) ln.classList.add(cssClass);
ln.append(document.createTextNode(args.join(' ')));
@ -101,25 +107,32 @@
}
const scope = wasm.scopedAllocPush();
const dbFile = 0 ? "" : pDir+"/speedtest1.db";
try{
const argv = [
// TODO: accept flags via URL arguments and/or a
// UI control. A multi-SELECT element should do
// nicely.
"speedtest1",
"--singlethread",
"--nomutex",
"--memdb", // note that memdb trumps the filename arg
dbFile
];
console.log("argv =",argv);
wasm.xCall('__main_argc_argv', argv.length,
wasm.scopedAllocMainArgv(argv));
}finally{
wasm.scopedAllocPop(scope);
if(pDir) unlink(dbFile);
}
};
const argv = [
// TODO: accept flags via URL arguments and/or a
// UI control. A multi-SELECT element should do
// nicely.
"speedtest1",
"--singlethread",
"--nomutex",
"--nosync",
"--nomemstat",
"--big-transactions", // important for tests 410 and 510!
//"--memdb", // note that memdb trumps the filename arg
dbFile
];
console.log("argv =",argv);
// These log messages are not emitted to the UI until after main() returns. Fixing that
// requires moving the main() call and related cleanup into a timeout handler.
log2('',"Starting native main() with flags:",argv.join(' '));
log2('',"This will take a while and the browser might warn about the runaway JS. Give it time.");
setTimeout(function(){
wasm.xCall('__main_argc_argv', argv.length,
wasm.scopedAllocMainArgv(argv));
wasm.scopedAllocPop(scope);
if(pDir) unlink(dbFile);
log2('',"Done running native main(). Check dev console for output.");
}, 100);
}/*runTests()*/;
self.sqlite3TestModule.print = log;
self.sqlite3TestModule.printErr = logErr;