Skip to content

Commit ebe10c3

Browse files
committed
simplified code: removed external/fastmod.h; removed additive_search; removed SDC and D-EF encoders
1 parent 1bf86cb commit ebe10c3

26 files changed

Lines changed: 395 additions & 1069 deletions

CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ MESSAGE(STATUS "CMAKE_BUILD_TYPE: " ${CMAKE_BUILD_TYPE})
99
if (NOT TARGET PTHASH)
1010
add_library(PTHASH INTERFACE)
1111
target_include_directories(PTHASH INTERFACE include)
12-
target_include_directories(PTHASH SYSTEM INTERFACE external/fastmod)
1312
target_include_directories(PTHASH SYSTEM INTERFACE external/mm_file/include)
1413
target_include_directories(PTHASH SYSTEM INTERFACE external/xxHash)
1514

external/fastmod/fastmod.h

Lines changed: 0 additions & 204 deletions
This file was deleted.

include/builders/external_memory_builder_partitioned_phf.hpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ struct external_memory_builder_partitioned_phf {
2121
util::check_hash_collision_probability<Hasher>(num_keys);
2222

2323
const uint64_t avg_partition_size = compute_avg_partition_size(num_keys, config);
24+
m_avg_partition_size = avg_partition_size;
2425
const uint64_t num_partitions = compute_num_partitions(num_keys, avg_partition_size);
2526
if (num_partitions == 0) throw std::invalid_argument("number of partitions must be > 0");
2627

@@ -200,6 +201,10 @@ struct external_memory_builder_partitioned_phf {
200201
return m_num_partitions;
201202
}
202203

204+
uint64_t avg_partition_size() const {
205+
return m_avg_partition_size;
206+
}
207+
203208
range_bucketer bucketer() const {
204209
return m_bucketer;
205210
}
@@ -268,6 +273,8 @@ struct external_memory_builder_partitioned_phf {
268273
uint64_t m_num_keys;
269274
uint64_t m_table_size;
270275
uint64_t m_num_partitions;
276+
uint64_t m_avg_partition_size;
277+
271278
range_bucketer m_bucketer;
272279
std::vector<uint64_t> m_offsets;
273280
builders_files_manager<internal_memory_builder_single_phf<hasher_type, Bucketer>> m_builders;

include/builders/external_memory_builder_single_phf.hpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ struct external_memory_builder_single_phf {
142142
auto pilots =
143143
tfm.get_multifile_pairs_writer(num_non_empty_buckets, ram_for_pilots, 1, 0);
144144

145-
search(m_num_keys, m_num_buckets, num_non_empty_buckets, m_seed, config,
146-
buckets_iterator, taken_bvb, pilots);
145+
search(m_num_keys, m_num_buckets, num_non_empty_buckets, //
146+
config, buckets_iterator, taken_bvb, pilots);
147147

148148
pilots.flush();
149149
buckets_iterator.close();
@@ -199,6 +199,14 @@ struct external_memory_builder_single_phf {
199199
return m_table_size;
200200
}
201201

202+
uint64_t num_partitions() const {
203+
return 0;
204+
}
205+
206+
uint64_t avg_partition_size() const {
207+
return 0;
208+
}
209+
202210
Bucketer bucketer() const {
203211
return m_bucketer;
204212
}
@@ -216,7 +224,9 @@ struct external_memory_builder_single_phf {
216224
uint64_t m_num_keys;
217225
uint64_t m_table_size;
218226
uint64_t m_num_buckets;
227+
219228
Bucketer m_bucketer;
229+
220230
std::string m_pilots_filename;
221231
std::string m_free_slots_filename;
222232

include/builders/internal_memory_builder_partitioned_phf.hpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ struct internal_memory_builder_partitioned_phf {
2020
const uint64_t avg_partition_size = config.dense_partitioning
2121
? find_avg_partition_size(num_keys)
2222
: compute_avg_partition_size(num_keys, config);
23+
m_avg_partition_size = avg_partition_size;
2324
const uint64_t num_partitions = compute_num_partitions(num_keys, avg_partition_size);
2425
assert(num_partitions > 0);
2526

@@ -255,6 +256,10 @@ struct internal_memory_builder_partitioned_phf {
255256
return m_num_partitions;
256257
}
257258

259+
uint64_t avg_partition_size() const {
260+
return m_avg_partition_size;
261+
}
262+
258263
uint64_t num_buckets_per_partition() const {
259264
return m_num_buckets_per_partition;
260265
}
@@ -405,8 +410,11 @@ struct internal_memory_builder_partitioned_phf {
405410
uint64_t m_num_keys;
406411
uint64_t m_table_size;
407412
uint64_t m_num_partitions;
413+
uint64_t m_avg_partition_size;
408414
uint64_t m_num_buckets_per_partition;
415+
409416
range_bucketer m_bucketer;
417+
410418
std::vector<uint64_t> m_offsets;
411419
std::vector<uint64_t> m_free_slots; // for dense partitioning
412420
std::vector<internal_memory_builder_single_phf<hasher_type, bucketer_type>> m_builders;

include/builders/internal_memory_builder_single_phf.hpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,8 @@ struct internal_memory_builder_single_phf {
117117
bits::bit_vector::builder taken_bvb(m_table_size);
118118
uint64_t num_non_empty_buckets = buckets.num_buckets();
119119
pilots_wrapper_t pilots_wrapper(m_pilots);
120-
search(m_num_keys, m_num_buckets, num_non_empty_buckets, m_seed, config,
121-
buckets_iterator, taken_bvb, pilots_wrapper);
120+
search(m_num_keys, m_num_buckets, num_non_empty_buckets, //
121+
config, buckets_iterator, taken_bvb, pilots_wrapper);
122122
taken_bvb.build(m_taken);
123123
if (config.minimal) {
124124
m_free_slots.clear();
@@ -152,6 +152,14 @@ struct internal_memory_builder_single_phf {
152152
return m_table_size;
153153
}
154154

155+
uint64_t num_partitions() const {
156+
return 0;
157+
}
158+
159+
uint64_t avg_partition_size() const {
160+
return 0;
161+
}
162+
155163
Bucketer bucketer() const {
156164
return m_bucketer;
157165
}
@@ -224,7 +232,9 @@ struct internal_memory_builder_single_phf {
224232
uint64_t m_num_keys;
225233
uint64_t m_num_buckets;
226234
uint64_t m_table_size;
235+
227236
Bucketer m_bucketer;
237+
228238
bits::bit_vector m_taken;
229239
std::vector<uint64_t> m_pilots;
230240
std::vector<uint64_t> m_free_slots;

0 commit comments

Comments
 (0)