mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
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%.
This commit is contained in:
parent
7d9653d51f
commit
619806d7a9
5 changed files with 95 additions and 131 deletions
30
cli/cache/common.rs
vendored
30
cli/cache/common.rs
vendored
|
@ -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;
|
||||
";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue