Skip to content

Commit 9fad736

Browse files
committed
Sort headers, fix const_iterator bug, optimize sizes for skylake.
1 parent 8cc2ced commit 9fad736

24 files changed

+40
-52
lines changed

CMakeLists.txt

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
1818
add_definitions(-DBOOST_SEGMENTED_TREE_DEBUG)
1919
endif ()
2020

21-
22-
find_package(Boost)
21+
find_package(Boost COMPONENTS unit_test_framework REQUIRED)
2322
include_directories (include)
2423
include_directories (SYSTEM submodule)
2524
include_directories (SYSTEM ${Boost_INCLUDE_DIRS})

bench/iterator.hpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#ifndef BENCH_ITERATOR
22
#define BENCH_ITERATOR
33

4-
#include "common.hpp"
5-
#include "../common/iterator.hpp"
6-
74
#include <stdexcept>
85
#include <type_traits>
96
#include <vector>
7+
#include "../common/iterator.hpp"
8+
#include "common.hpp"
109

1110
template <typename Container, typename T>
1211
void bench_iterator(Container const &container, std::vector<T> const &data) {

bench/range_btree_seq_64.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include "range.hpp"
21
#include "array/trunk/btree_seq.h"
2+
#include "range.hpp"
33

44
template <typename T>
55
using Container = btree_seq<T>;

bench/range_btree_seq_8.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include "range.hpp"
21
#include "array/trunk/btree_seq.h"
2+
#include "range.hpp"
33

44
template <typename T>
55
using Container = btree_seq<T>;

bench/range_deque_8.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#include "range.hpp"
2-
31
#include <deque>
2+
#include "range.hpp"
43

54
template <typename T>
65
using Container = std::deque<T>;

bench/range_segmented_tree_seq_64.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include "range.hpp"
21
#include "boost/segmented_tree/seq.hpp"
2+
#include "range.hpp"
33

44
template <typename T>
55
using Container = boost::segmented_tree::seq<T>;

bench/range_vector_64.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#include "range.hpp"
2-
31
#include <vector>
2+
#include "range.hpp"
43

54
template <typename T>
65
using Container = std::vector<T>;

bench/range_vector_8.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#include "range.hpp"
2-
31
#include <vector>
2+
#include "range.hpp"
43

54
template <typename T>
65
using Container = std::vector<T>;

bench/single.hpp

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
#ifndef BENCH_SINGLE
22
#define BENCH_SINGLE
33

4-
#include "iterator.hpp"
5-
#include "../common/single.hpp"
6-
4+
#include <boost/lexical_cast.hpp>
75
#include <cstdlib>
86
#include <limits>
9-
#include <boost/lexical_cast.hpp>
7+
#include "../common/single.hpp"
8+
#include "iterator.hpp"
109

1110
template <template <typename T> class Container, typename T>
1211
int bench_single(int argc, char **argv) {

bench/single_btree_seq_64.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include "single.hpp"
21
#include "array/trunk/btree_seq.h"
2+
#include "single.hpp"
33

44
template <typename T>
55
using Container = btree_seq<T>;

bench/single_btree_seq_8.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include "single.hpp"
21
#include "array/trunk/btree_seq.h"
2+
#include "single.hpp"
33

44
template <typename T>
55
using Container = btree_seq<T>;

bench/single_deque_64.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#include "single.hpp"
2-
31
#include <deque>
2+
#include "single.hpp"
43

54
template <typename T>
65
using Container = std::deque<T>;

bench/single_deque_8.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#include "single.hpp"
2-
31
#include <deque>
2+
#include "single.hpp"
43

54
template <typename T>
65
using Container = std::deque<T>;

bench/single_segmented_tree_seq_64.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include "single.hpp"
21
#include "boost/segmented_tree/seq.hpp"
2+
#include "single.hpp"
33

44
template <typename T>
55
using Container = boost::segmented_tree::seq<T>;

bench/single_segmented_tree_seq_8.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
#include "single.hpp"
21
#include "boost/segmented_tree/seq.hpp"
2+
#include "single.hpp"
33

44
template <typename T>
55
using Container = boost::segmented_tree::seq<T>;

bench/single_vector_64.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#include "single.hpp"
2-
31
#include <vector>
2+
#include "single.hpp"
43

54
template <typename T>
65
using Container = std::vector<T>;

bench/single_vector_8.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
#include "single.hpp"
2-
31
#include <vector>
2+
#include "single.hpp"
43

54
template <typename T>
65
using Container = std::vector<T>;

common/common.hpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
#ifndef COMMON_COMMON
22
#define COMMON_COMMON
33

4-
#include <cstdint>
5-
#include <cstdlib>
6-
#include <type_traits>
7-
#include <vector>
84
#include <boost/crc.hpp>
95
#include <boost/random/independent_bits.hpp>
106
#include <boost/random/mersenne_twister.hpp>
117
#include <boost/random/seed_seq.hpp>
8+
#include <cstdint>
9+
#include <cstdlib>
1210
#include <random>
11+
#include <type_traits>
12+
#include <vector>
1313

1414
template <typename T>
1515
struct insertion_data {

common/generate_range.hpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#ifndef BENCH_GENERATE_RANGE
22
#define BENCH_GENERATE_RANGE
33

4-
#include "range.hpp"
5-
6-
#include <iostream>
74
#include <boost/lexical_cast.hpp>
5+
#include <iostream>
6+
#include "range.hpp"
87

98
template <typename T>
109
int generate_range(int argc, char **argv) {

common/generate_single.hpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
#ifndef BENCH_GENERATE_SINGLE
22
#define BENCH_GENERATE_SINGLE
33

4-
#include "single.hpp"
5-
6-
#include <iostream>
74
#include <boost/lexical_cast.hpp>
5+
#include <iostream>
6+
#include "single.hpp"
87

98
template <typename T>
109
int generate_single(int argc, char **argv) {

include/boost/segmented_tree/seq.hpp

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77

88
#include "seq_fwd.hpp"
99

10-
#include <array>
1110
#include <algorithm>
11+
#include <array>
1212
#include <cstring>
13+
#include <functional>
1314
#include <limits>
14-
#include <utility>
1515
#include <type_traits>
16+
#include <utility>
1617

1718
#ifdef BOOST_SEGMENTED_TREE_DEBUG
1819
#include <iostream>
@@ -3533,7 +3534,8 @@ class seq {
35333534
/// Basic.
35343535
void splice(const_iterator pos, seq &other, const_iterator first,
35353536
const_iterator last) {
3536-
insert(pos, std::make_move_iterator(first), std::make_move_iterator(last));
3537+
insert(pos, std::make_move_iterator(iterator{first.it_}),
3538+
std::make_move_iterator(iterator{last.it_}));
35373539
other.erase(first, last);
35383540
}
35393541

include/boost/segmented_tree/seq_fwd.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
namespace boost {
1111
namespace segmented_tree {
1212
template <typename T, typename Allocator = std::allocator<T>,
13-
std::size_t segment_target = 512, std::size_t base_target = 512>
13+
std::size_t segment_target = 1024, std::size_t base_target = 768>
1414
class seq;
1515
}
1616
}

test/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
add_executable(test_sequence_0 test_sequence.cpp)
2-
target_link_libraries(test_sequence_0 boost_unit_test_framework)
2+
target_link_libraries(test_sequence_0 ${Boost_LIBRARIES})
33
set_property(TARGET test_sequence_0 PROPERTY COMPILE_DEFINITIONS
44
BOOST_TEST_DYN_LINK TARGET_SIZE=0)
55

66
add_executable(test_sequence_512 test_sequence.cpp)
7-
target_link_libraries(test_sequence_512 boost_unit_test_framework)
7+
target_link_libraries(test_sequence_512 ${Boost_LIBRARIES})
88
set_property(TARGET test_sequence_512 PROPERTY COMPILE_DEFINITIONS
99
BOOST_TEST_DYN_LINK TARGET_SIZE=512)
1010

test/test_sequence.cpp

+4-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
#define BOOST_TEST_MODULE test_sequence
22

3-
#include <boost/test/unit_test.hpp>
43
#include <boost/segmented_tree/seq.hpp>
5-
6-
#include "../common/single.hpp"
7-
#include "../common/range.hpp"
8-
#include "../common/iterator.hpp"
9-
4+
#include <boost/test/unit_test.hpp>
105
#include <exception>
116
#include <limits>
7+
#include "../common/iterator.hpp"
8+
#include "../common/range.hpp"
9+
#include "../common/single.hpp"
1210

1311
template <typename T, typename Alloc = std::allocator<T>>
1412
using seq = boost::segmented_tree::seq<T, Alloc, TARGET_SIZE>;

0 commit comments

Comments
 (0)