aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorMarco Poletti <poletti.marco@gmail.com>2018-09-11 07:25:58 +0100
committerMarco Poletti <poletti.marco@gmail.com>2018-09-12 20:51:11 +0100
commitbc7a2df82702604d37cf6bd9c6ecbbd6d728667f (patch)
tree39b70e4bce721da76860c13ee1189ea81159d7ec /include
parente66c4108789b5a8804967164e6b5f6cfc879c154 (diff)
downloadgoogle-fruit-bc7a2df82702604d37cf6bd9c6ecbbd6d728667f.tar.gz
Revert part of commit f06151, that part actually made Fruit slightly slower now that the hash table is bigger.
Diffstat (limited to 'include')
-rw-r--r--include/fruit/impl/data_structures/semistatic_graph.templates.h20
-rw-r--r--include/fruit/impl/data_structures/semistatic_map.h2
-rw-r--r--include/fruit/impl/data_structures/semistatic_map.templates.h5
3 files changed, 5 insertions, 22 deletions
diff --git a/include/fruit/impl/data_structures/semistatic_graph.templates.h b/include/fruit/impl/data_structures/semistatic_graph.templates.h
index 06aed8d..37e9484 100644
--- a/include/fruit/impl/data_structures/semistatic_graph.templates.h
+++ b/include/fruit/impl/data_structures/semistatic_graph.templates.h
@@ -45,11 +45,6 @@ struct indexing_iterator {
index += index_increment;
}
- void operator+=(std::size_t n) {
- iter += n;
- index += index_increment * n;
- }
-
auto operator*() -> decltype(std::make_pair(*iter, SemistaticGraphInternalNodeId{index})) {
return std::make_pair(*iter, SemistaticGraphInternalNodeId{index});
}
@@ -101,20 +96,9 @@ SemistaticGraph<NodeId, Node>::SemistaticGraph(NodeIter first, NodeIter last, Me
}
using itr_t = typename HashSetWithArenaAllocator<NodeId>::iterator;
- FixedSizeVector<NodeId, ArenaAllocator<NodeId>> node_ids_vector(
- node_ids.size(), NodeId{}, ArenaAllocator<NodeId>(memory_pool));
- {
- itr_t itr = node_ids.begin();
- for (std::size_t i = 0; i < node_ids.size(); ++i, ++itr) {
- node_ids_vector[i] = *itr;
- }
- }
-
-
node_index_map = SemistaticMap<NodeId, InternalNodeId>(
- indexing_iterator<typename FixedSizeVector<NodeId, ArenaAllocator<NodeId>>::iterator, sizeof(NodeData)>{
- node_ids_vector.begin(),
- 0},
+ indexing_iterator<itr_t, sizeof(NodeData)>{node_ids.begin(), 0},
+ indexing_iterator<itr_t, sizeof(NodeData)>{node_ids.end(), node_ids.size() * sizeof(NodeData)},
node_ids.size(),
memory_pool);
diff --git a/include/fruit/impl/data_structures/semistatic_map.h b/include/fruit/impl/data_structures/semistatic_map.h
index aa5bf3a..cd03cc2 100644
--- a/include/fruit/impl/data_structures/semistatic_map.h
+++ b/include/fruit/impl/data_structures/semistatic_map.h
@@ -92,7 +92,7 @@ public:
* The MemoryPool is only used during construction, the constructed object *can* outlive the memory pool.
*/
template <typename Iter>
- SemistaticMap(Iter begin, std::size_t num_values, MemoryPool& memory_pool);
+ SemistaticMap(Iter begin, Iter end, std::size_t num_values, MemoryPool& memory_pool);
// Creates a shallow copy of `map' with the additional elements in new_elements.
// The keys in new_elements must be unique and must not be present in `map'.
diff --git a/include/fruit/impl/data_structures/semistatic_map.templates.h b/include/fruit/impl/data_structures/semistatic_map.templates.h
index 5b94337..7c62f24 100644
--- a/include/fruit/impl/data_structures/semistatic_map.templates.h
+++ b/include/fruit/impl/data_structures/semistatic_map.templates.h
@@ -40,11 +40,10 @@ namespace impl {
template <typename Key, typename Value>
template <typename Iter>
-SemistaticMap<Key, Value>::SemistaticMap(Iter values_begin, std::size_t num_values, MemoryPool& memory_pool) {
+SemistaticMap<Key, Value>::SemistaticMap(
+ Iter values_begin, Iter values_end, std::size_t num_values, MemoryPool& memory_pool) {
NumBits num_bits = pickNumBits(num_values);
std::size_t num_buckets = size_t(1) << num_bits;
- Iter values_end = values_begin;
- values_end += num_values;
FixedSizeVector<Unsigned, ArenaAllocator<Unsigned>> count(num_buckets, 0, ArenaAllocator<Unsigned>(memory_pool));