mirror of
https://github.com/mhx/dwarfs.git
synced 2025-09-09 04:19:10 -04:00
Replace dense_hash_map with F14 maps
This commit is contained in:
parent
41c76963b1
commit
e849fa158b
@ -102,8 +102,6 @@ if(NOT FUSE_FOUND AND NOT FUSE3_FOUND)
|
||||
message(FATAL_ERROR "No FUSE or FUSE3 library found")
|
||||
endif()
|
||||
|
||||
find_path(SPARSEHASH_INCLUDE_DIR sparsehash/dense_hash_map
|
||||
DOC "dense_hash_map header" REQUIRED)
|
||||
find_program(RONN_EXE ronn DOC "ronn man page generator" REQUIRED)
|
||||
|
||||
if(USE_JEMALLOC)
|
||||
@ -358,8 +356,7 @@ list(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/fbthrift
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/zstd/lib
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/xxHash
|
||||
${CMAKE_CURRENT_BINARY_DIR}
|
||||
${SPARSEHASH_INCLUDE_DIR})
|
||||
${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
if(USE_JEMALLOC)
|
||||
list(APPEND INCLUDE_DIRS ${Jemalloc_INCLUDE_DIRS})
|
||||
|
@ -158,8 +158,7 @@ A good starting point for apt-based systems is probably:
|
||||
libelf-dev \
|
||||
libfmt-dev \
|
||||
libfuse3-dev \
|
||||
libgoogle-glog-dev \
|
||||
libsparsehash-dev
|
||||
libgoogle-glog-dev
|
||||
|
||||
You can pick either `clang` or `g++`, but at least recent `clang`
|
||||
versions will produce substantially faster code:
|
||||
|
@ -31,8 +31,7 @@
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <sparsehash/dense_hash_map>
|
||||
|
||||
#include <folly/container/F14Map.h>
|
||||
#include <folly/small_vector.h>
|
||||
#include <folly/stats/Histogram.h>
|
||||
|
||||
@ -87,19 +86,16 @@ struct bm_stats {
|
||||
folly::Histogram<size_t> l2_collision_vec_size;
|
||||
};
|
||||
|
||||
template <typename KeyT, typename ValT, KeyT EmptyKey = KeyT{},
|
||||
size_t MaxCollInline = 2>
|
||||
template <typename KeyT, typename ValT, size_t MaxCollInline = 2>
|
||||
class fast_multimap {
|
||||
private:
|
||||
using collision_vector = folly::small_vector<ValT, MaxCollInline>;
|
||||
using blockhash_t = google::dense_hash_map<KeyT, ValT>;
|
||||
using collision_t = std::unordered_map<KeyT, collision_vector>;
|
||||
using blockhash_t = folly::F14ValueMap<KeyT, ValT>;
|
||||
using collision_t = folly::F14FastMap<KeyT, collision_vector>;
|
||||
|
||||
public:
|
||||
fast_multimap() { values_.set_empty_key(EmptyKey); }
|
||||
|
||||
void insert(KeyT const& key, ValT const& val) {
|
||||
if (key == EmptyKey or !values_.insert(std::make_pair(key, val)).second) {
|
||||
if (!values_.insert(std::make_pair(key, val)).second) {
|
||||
collisions_[key].emplace_back(val);
|
||||
}
|
||||
}
|
||||
|
@ -26,10 +26,10 @@
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/python.hpp>
|
||||
|
||||
#include <sparsehash/dense_hash_map>
|
||||
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <folly/container/F14Map.h>
|
||||
|
||||
#include "dwarfs/entry.h"
|
||||
#include "dwarfs/error.h"
|
||||
#include "dwarfs/inode.h"
|
||||
@ -396,8 +396,7 @@ void python_script::impl::order(inode_vector& iv) {
|
||||
td << "ordered files in script code";
|
||||
}
|
||||
|
||||
google::dense_hash_map<inode const*, size_t> priority(iv.size());
|
||||
priority.set_empty_key(nullptr);
|
||||
folly::F14FastMap<inode const*, size_t> priority(iv.size());
|
||||
|
||||
auto td = LOG_TIMED_DEBUG;
|
||||
size_t index = 0;
|
||||
|
Loading…
x
Reference in New Issue
Block a user