diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-03-22 01:01:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-22 00:01:15 +0000 |
commit | 619806d7a9723eebe825281286b293b9b64f878e (patch) | |
tree | 8aad2126acc05f36033d2a009f427fbd5b26a5b3 /cli/cache/common.rs | |
parent | 7d9653d51fb0c4d3844f61e1214b6bddc50d2cef (diff) |
perf: disable WAL for transpiled source cache (#18084)
Disable Write-Ahead Log for the cached module source database.
This brings SQLite connection cost on startup from 2.5% to 1.6%.
Diffstat (limited to 'cli/cache/common.rs')
-rw-r--r-- | cli/cache/common.rs | 30 |
1 files changed, 11 insertions, 19 deletions
diff --git a/cli/cache/common.rs b/cli/cache/common.rs index 33623bb79..1e6c5aa92 100644 --- a/cli/cache/common.rs +++ b/cli/cache/common.rs @@ -2,9 +2,6 @@ use std::hash::Hasher; -use deno_core::error::AnyError; -use deno_runtime::deno_webstorage::rusqlite::Connection; - /// A very fast insecure hasher that uses the xxHash algorithm. #[derive(Default)] pub struct FastInsecureHasher(twox_hash::XxHash64); @@ -47,19 +44,14 @@ impl FastInsecureHasher { } } -/// Runs the common sqlite pragma. -pub fn run_sqlite_pragma(conn: &Connection) -> Result<(), AnyError> { - // Enable write-ahead-logging and tweak some other stuff - let initial_pragmas = " - -- enable write-ahead-logging mode - PRAGMA journal_mode=WAL; - PRAGMA synchronous=NORMAL; - PRAGMA temp_store=memory; - PRAGMA page_size=4096; - PRAGMA mmap_size=6000000; - PRAGMA optimize; - "; - - conn.execute_batch(initial_pragmas)?; - Ok(()) -} +/// Disable write-ahead-logging and tweak some other stuff. +/// We want to favor startup time over cache performance and +/// creating a WAL is expensive on startup. +pub static INITIAL_PRAGMAS: &str = " + PRAGMA journal_mode=OFF; + PRAGMA synchronous=NORMAL; + PRAGMA temp_store=memory; + PRAGMA page_size=4096; + PRAGMA mmap_size=6000000; + PRAGMA optimize; +"; |