diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2012-11-04 17:11:48 +0100 |
---|---|---|
committer | Pieter Wuille <pieter.wuille@gmail.com> | 2012-11-04 18:06:25 +0100 |
commit | 1c83b0a3771bc601fdc75588f2cd45318b19c526 (patch) | |
tree | 3c81936fefc0a962c764522057cb6d68e6c230e4 /src/leveldb.cpp | |
parent | a56d3f8a10e3c9f844aee1f362635ae14b872023 (diff) |
Cache size optimizations
Diffstat (limited to 'src/leveldb.cpp')
-rw-r--r-- | src/leveldb.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/leveldb.cpp b/src/leveldb.cpp index e8a0fbe874..58b75e5295 100644 --- a/src/leveldb.cpp +++ b/src/leveldb.cpp @@ -12,22 +12,22 @@ #include <boost/filesystem.hpp> -static leveldb::Options GetOptions() { +static leveldb::Options GetOptions(size_t nCacheSize) { leveldb::Options options; - int nCacheSizeMB = GetArg("-dbcache", 25); - options.block_cache = leveldb::NewLRUCache(nCacheSizeMB * 1048576); + options.block_cache = leveldb::NewLRUCache(nCacheSize / 2); + options.write_buffer_size = nCacheSize / 4; // up to two write buffers may be held in memory simultaneously options.filter_policy = leveldb::NewBloomFilterPolicy(10); options.compression = leveldb::kNoCompression; return options; } -CLevelDB::CLevelDB(const boost::filesystem::path &path, bool fMemory) { +CLevelDB::CLevelDB(const boost::filesystem::path &path, size_t nCacheSize, bool fMemory) { penv = NULL; readoptions.verify_checksums = true; iteroptions.verify_checksums = true; iteroptions.fill_cache = false; syncoptions.sync = true; - options = GetOptions(); + options = GetOptions(nCacheSize); options.create_if_missing = true; if (fMemory) { penv = leveldb::NewMemEnv(leveldb::Env::Default()); |