From 1e278d55c4dc0a9ae7b5b4511904202824e5c5df Mon Sep 17 00:00:00 2001 From: jacqueline Date: Tue, 2 Apr 2024 19:36:35 +1100 Subject: tweak db performance - leveldb cache pinned to spiram - actually use it during indexing lol - all up, saves about 10ms per file (amortised) for an incremental reindex --- src/database/database.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/database/database.cpp') diff --git a/src/database/database.cpp b/src/database/database.cpp index 06138983..48fb0c63 100644 --- a/src/database/database.cpp +++ b/src/database/database.cpp @@ -139,14 +139,14 @@ auto Database::Open(IFileGatherer& gatherer, [&]() -> cpp::result { leveldb::DB* db; std::unique_ptr cache{ - leveldb::NewLRUCache(4 * 1024)}; + leveldb::NewLRUCache(256 * 1024)}; leveldb::Options options; options.env = sEnv.env(); options.write_buffer_size = 4 * 1024; - options.max_file_size = 32; + options.max_file_size = 16 * 1024; options.block_cache = cache.get(); - options.block_size = 512; + options.block_size = 2048; auto status = leveldb::DB::Open(options, kDbPath, &db); if (!status.ok()) { @@ -299,7 +299,7 @@ auto Database::updateIndexes() -> void { UpdateNotifier notifier{is_updating_}; leveldb::ReadOptions read_options; - read_options.fill_cache = false; + read_options.fill_cache = true; // Stage 1: verify all existing tracks are still valid. ESP_LOGI(kTag, "verifying existing tracks"); -- cgit v1.2.3