mirror of
https://github.com/aljazceru/turso.git
synced 2026-01-08 18:54:21 +01:00
The default Rust hash map is slow for integer keys. Switch to FxHash
instead to reduce executed instructions for, for example, throughput
benchmark.
Note that dirty page tracking is changed to BTreeMap to ensure that the
hash function changes don't impact the WAL frame order, which SQLite
guarantees to be page number ordered.
Before:
```
penberg@turing:~/src/tursodatabase/turso/perf/throughput/turso$ perf stat ../../../target/release/write-throughput --threads 1 --batch-size 100 --compute 0 -i 10000
Turso,1,100,0,106875.21
Performance counter stats for '../../../target/release/write-throughput --threads 1 --batch-size 100 --compute 0 -i 10000':
2,908.02 msec task-clock # 0.310 CPUs utilized
30,508 context-switches # 10.491 K/sec
261 cpu-migrations # 89.752 /sec
813 page-faults # 279.572 /sec
20,655,313,128 instructions # 1.73 insn per cycle
# 0.14 stalled cycles per insn
11,930,088,949 cycles # 4.102 GHz
2,845,040,381 stalled-cycles-frontend # 23.85% frontend cycles idle
3,814,652,892 branches # 1.312 G/sec
54,760,600 branch-misses # 1.44% of all branches
9.372979876 seconds time elapsed
2.276835000 seconds user
0.530135000 seconds sys
```
After:
```
penberg@turing:~/src/tursodatabase/turso/perf/throughput/turso$ perf stat ../../../target/release/write-throughput --threads 1 --batch-size 100 --compute 0 -i 10000
Turso,1,100,0,108663.84
Performance counter stats for '../../../target/release/write-throughput --threads 1 --batch-size 100 --compute 0 -i 10000':
2,838.65 msec task-clock # 0.308 CPUs utilized
30,629 context-switches # 10.790 K/sec
351 cpu-migrations # 123.650 /sec
818 page-faults # 288.165 /sec
19,887,102,451 instructions # 1.72 insn per cycle
# 0.14 stalled cycles per insn
11,593,166,024 cycles # 4.084 GHz
2,830,298,617 stalled-cycles-frontend # 24.41% frontend cycles idle
3,764,334,333 branches # 1.326 G/sec
53,157,766 branch-misses # 1.41% of all branches
9.218225731 seconds time elapsed
2.231889000 seconds user
0.508785000 seconds sys
```
128 lines
3.4 KiB
TOML
128 lines
3.4 KiB
TOML
# Copyright 2023-2025 the Turso authors. All rights reserved. MIT license.
|
|
|
|
[package]
|
|
name = "turso_core"
|
|
version.workspace = true
|
|
authors.workspace = true
|
|
edition.workspace = true
|
|
license.workspace = true
|
|
repository.workspace = true
|
|
description = "The Turso database library"
|
|
|
|
[lib]
|
|
name = "turso_core"
|
|
path = "lib.rs"
|
|
|
|
[features]
|
|
default = ["fs", "uuid", "time", "json", "series", "encryption"]
|
|
antithesis = ["dep:antithesis_sdk", "antithesis_sdk?/full"]
|
|
tracing_release = ["tracing/release_max_level_info"]
|
|
conn_raw_api = []
|
|
fs = ["turso_ext/vfs"]
|
|
json = []
|
|
uuid = ["dep:uuid"]
|
|
io_uring = ["dep:io-uring", "rustix/io_uring"]
|
|
time = []
|
|
fuzz = []
|
|
omit_autovacuum = []
|
|
simulator = ["fuzz", "serde"]
|
|
serde = ["dep:serde"]
|
|
series = []
|
|
encryption = []
|
|
checksum = []
|
|
cli_only = []
|
|
test_helper = []
|
|
|
|
[target.'cfg(target_os = "linux")'.dependencies]
|
|
io-uring = { version = "0.7.5", optional = true }
|
|
libc = { version = "0.2.172" }
|
|
|
|
[target.'cfg(target_family = "unix")'.dependencies]
|
|
polling = "3.7.4"
|
|
rustix = { version = "1.0.5", features = ["fs"] }
|
|
libc = { version = "0.2.172" }
|
|
|
|
[target.'cfg(not(target_family = "wasm"))'.dependencies]
|
|
libloading = "0.8.6"
|
|
|
|
[dependencies]
|
|
antithesis_sdk = { workspace = true, optional = true }
|
|
turso_ext = { workspace = true, features = ["core_only"] }
|
|
cfg_block = "0.1.1"
|
|
fallible-iterator = { workspace = true }
|
|
hex = { workspace = true }
|
|
thiserror = { workspace = true }
|
|
regex = { workspace = true }
|
|
regex-syntax = { workspace = true, default-features = false, features = [
|
|
"unicode",
|
|
] }
|
|
chrono = { workspace = true, default-features = false, features = ["clock"] }
|
|
rand = { workspace = true }
|
|
libm = "0.2"
|
|
turso_macros = { workspace = true }
|
|
miette = { workspace = true }
|
|
strum = { workspace = true }
|
|
parking_lot = { workspace = true }
|
|
crossbeam-skiplist = "0.1.3"
|
|
tracing = { workspace = true }
|
|
ryu = "1.0.19"
|
|
uncased = "0.9.10"
|
|
strum_macros = { workspace = true }
|
|
bitflags = { workspace = true }
|
|
serde = { workspace = true, optional = true, features = ["derive"] }
|
|
paste = "1.0.15"
|
|
uuid = { version = "1.11.0", features = ["v4", "v5", "v7"], optional = true }
|
|
tempfile = { workspace = true }
|
|
pack1 = { version = "1.0.0", features = ["bytemuck"] }
|
|
bytemuck = "1.23.1"
|
|
aes-gcm = { version = "0.10.3"}
|
|
aes = { version = "0.8.4"}
|
|
turso_parser = { workspace = true }
|
|
aegis = "0.9.0"
|
|
twox-hash = "2.1.1"
|
|
intrusive-collections = "0.9.7"
|
|
roaring = "0.11.2"
|
|
simsimd = "6.5.3"
|
|
arc-swap = "1.7"
|
|
rustc-hash = "2.0"
|
|
|
|
[build-dependencies]
|
|
chrono = { workspace = true, default-features = false }
|
|
built = { version = "0.7.5", features = ["git2", "chrono"] }
|
|
|
|
[target.'cfg(not(target_family = "windows"))'.dev-dependencies]
|
|
pprof = { version = "0.14.0", features = ["criterion", "flamegraph"] }
|
|
|
|
[dev-dependencies]
|
|
memory-stats = "1.2.0"
|
|
criterion = { workspace = true, features = [
|
|
"html_reports",
|
|
"async",
|
|
"async_futures",
|
|
] }
|
|
rstest = "0.18.2"
|
|
rusqlite = { workspace = true, features = ["series"] }
|
|
quickcheck = { version = "1.0", default-features = false }
|
|
quickcheck_macros = { version = "1.0", default-features = false }
|
|
rand_chacha = { workspace = true }
|
|
env_logger = { workspace = true }
|
|
test-log = { version = "0.2.17", features = ["trace"] }
|
|
sorted-vec = "0.8.6"
|
|
mimalloc = { workspace = true, default-features = false }
|
|
|
|
[[bench]]
|
|
name = "benchmark"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "mvcc_benchmark"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "json_benchmark"
|
|
harness = false
|
|
|
|
[[bench]]
|
|
name = "tpc_h_benchmark"
|
|
harness = false
|