Skip to content

performance guide

Tyler Neely edited this page Jun 6, 2019 · 3 revisions

Built-In Profiler

To get a summary of latency histograms relating to different operations you've used on a sled database, you can set print_profile_on_drop(true) on a ConfigBuilder:

let config = sled::ConfigBuilder::new()
    .print_profile_on_drop(true)
    .build();

let db = sled::Db::start(config).unwrap();

This is useful for finding outliars, general percentiles about usage, and especially for debugging performance issues if you create an issue on github.

Use jemalloc

jemalloc can dramatically improve performance in some situations, but you should always measure performance before and after using it, because maybe for some use cases it can cause regressions.

Cargo.toml:

[dependencies]
jemallocator = "0.1"

your_code.rs:

#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
Clone this wiki locally