Skip to content

Commit

Permalink
Use zstd and jemalloc
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed May 11, 2022
1 parent ce739f0 commit 414fb76
Show file tree
Hide file tree
Showing 55 changed files with 30 additions and 44,099 deletions.
8 changes: 7 additions & 1 deletion binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,14 @@ NAPI_METHOD(db_open) {
const auto location = ToString(env, argv[1]);
options.create_if_missing = BooleanProperty(env, argv[2], "createIfMissing").value_or(true);
options.error_if_exists = BooleanProperty(env, argv[2], "errorIfExists").value_or(false);
options.compression = BooleanProperty(env, argv[2], "compression").value_or((true)) ? rocksdb::kSnappyCompression
options.compression = BooleanProperty(env, argv[2], "compression").value_or((true)) ? rocksdb::kZSTD
: rocksdb::kNoCompression;
if (options.compression == rocksdb::kZSTD) {
options.compression_opts.max_dict_bytes = 16 * 1024;
options.compression_opts.zstd_max_train_bytes = 16 * 1024 * 100;
// options.compression_opts.parallel_threads
}

options.use_adaptive_mutex = BooleanProperty(env, argv[2], "useAdaptiveMutex").value_or(true);
options.enable_pipelined_write = BooleanProperty(env, argv[2], "enablePipelinedWrite").value_or(true);
options.max_background_jobs =
Expand Down
12 changes: 10 additions & 2 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@
"ccflags": ["-flto"],
"cflags!": ["-fno-exceptions"],
"cflags_cc!": ["-fno-exceptions"],
"ldflags": ["-flto", "-fuse-linker-plugin"]
"ldflags": ["-flto", "-fuse-linker-plugin"],
"libraries": [
"/usr/lib/x86_64-linux-gnu/libzstd.a",
"/usr/lib/x86_64-linux-gnu/libjemalloc_pic.a",
]
}
],
[
Expand All @@ -71,7 +75,11 @@
"GCC_ENABLE_CPP_RTTI": "YES",
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
"MACOSX_DEPLOYMENT_TARGET": "10.15"
}
},
"libraries": [
"/opt/homebrew/Cellar/zstd/1.5.2/lib/libzstd.dylib",
"/opt/homebrew/Cellar/jemalloc/5.3.0/lib/libjemalloc.dylib"
],
}
]
],
Expand Down
19 changes: 13 additions & 6 deletions deps/rocksdb/rocksdb.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@
"target_name": "rocksdb",
"type": "static_library",
"standalone_static_library": 1,
"dependencies": ["../snappy/snappy.gyp:snappy"],
"direct_dependent_settings": { "include_dirs": ["rocksdb/include/"] },
"defines": [
"SNAPPY=1",
"ZSTD=1",
"ZSTD_STATIC_LINKING_ONLY=1",
"ROCKSDB_JEMALLOC=1",
"JEMALLOC_NO_DEMANGLE=1",
"ROCKSDB_BACKTRACE=1",
"ROCKSDB_SUPPORT_THREAD_LOCAL=1",
"NIOSTATS_CONTEXT=1",
"NPERF_CONTEXT=1"
],
"include_dirs": ["rocksdb/", "rocksdb/include/"],
"include_dirs": [
"rocksdb/",
"rocksdb/include/"
],
"conditions": [
[
"OS == 'win'",
Expand Down Expand Up @@ -84,8 +89,6 @@
"ROCKSDB_RANGESYNC_PRESENT=1",
"ROCKSDB_SCHED_GETCPU_PRESENT=1",
"ROCKSDB_IOURING_PRESENT=1",
# "ROCKSDB_JEMALLOC=1",
# "JEMALLOC_NO_DEMANGLE=1",
"HAVE_SSE42=1",
"HAVE_BMI=1",
"HAVE_LZCNT=1",
Expand Down Expand Up @@ -128,7 +131,11 @@
"GCC_ENABLE_CPP_RTTI": "YES",
"GCC_ENABLE_CPP_EXCEPTIONS": "YES",
"MACOSX_DEPLOYMENT_TARGET": "10.15"
}
},
"include_dirs": [
"/opt/homebrew/Cellar/zstd/1.5.2/include",
"/opt/homebrew/Cellar/jemalloc/5.3.0/include"
],
}
]
],
Expand Down
135 changes: 0 additions & 135 deletions deps/snappy/freebsd/config.h

This file was deleted.

100 changes: 0 additions & 100 deletions deps/snappy/freebsd/snappy-stubs-public.h

This file was deleted.

Loading

0 comments on commit 414fb76

Please sign in to comment.