Fast vectors/containers library in C++
.
All vectors are implemented for C++20
although they are guaranteed to be compatible with C++17
. Vectors implement standard methods although they may break the standard sometimes if it is time-complexity beneficial.
static_vector
- vector with static storagevector
- standard vector with dynamic storage, by default usingmremap
Linux system call for high performance
This is headers-only library. You can manually copy include
folder into your project/destination:
# Clone the repo.
git clone https://github.com/nan0S/fast-vectors
# Change directory into repo.
cd fast-vectors
# Copy include folder to custom destination.
cp -r include PROJECT/PATH
or install library system-wide:
# Clone the repo.
git clone https://github.com/nan0S/fast-vectors
# Change directory into repo.
cd fast-vectors
# Install library.
sudo make install
make install
- install code locallymake uninstall
- uninstall code locallymake all
- compile all sourcesmake run-all
- compile and run all tests and benchmarksmake run-benchmarks
- compile run all benchmarks one after another (warning: increase stack limit size with e.g.ulimit -s unlimited
)make run-tests
- compile and run all tests one after anothermake run-bench_name
- compile and run only benchmark namedbench_name
(e.g.make run-simple_vector_benchmark
)make run-test_name
- compile and run only test namedtest_name
(e.g.make run-simple_test
)
sudo make install
/* main.cpp */
#include <uwr/static_vector.hpp>
#include <uwr/vector.hpp>
int main() {
uwr::static_vector<int, 5> sv { 1, 2, 3 };
sv.push_back(10);
sv.erase(sv.begin() + 1, sv.begin() + 3);
uwr::vector<std::string> v { "this", "is", "example" };
v.push_back("code");
v.insert(v.end(), "1");
v.clear();
return 0;
}
Only for benchmarks and tests - BOOST library, GoogleTest and GoogleBenchmark. Containers itself do not require any additional libraries.
If you want to run benchmarks run command sudo cpupower frequency-set --governor performance
before to get reliable results. This command disables CPU Frequency Scaling. To restore CPU Frequnecy Scaling type sudo cpupower frequency-set --governor powersave
after the benchmarks. Also make sure to increase stack limit size with: ulimit -s unlimited
for some benchmarks/tests.