diff options
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; +"; |