A quick pool allocator for c++ with type info and gc support
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
The project is a simple, fast, and memory-efficient pool allocator for c and c++. It is still underdevelopment and not production ready. More testing is needed to ensure it works in general cases.
- Header only
- Type-aware memory management
- Garbage collection
- Dynamic pool size
- Compiler that supports
c++ 11
or later
This is an example of how you may give instructions on setting up your project locally. To get a local copy up and running follow these simple example steps.
A c++ compiler supporting c++ 11
or later is required.
For example:
- clang++ (linux, macos, windows, etc.)
- g++ (linux, macos, windows, etc.)
- msvc (windows)
- mingw (windows)
- cygwin-gcc (windows)
This is a header-only library. Doesn't require any other dependencies.
- Clone the repo
git clone https://github.com/yusing/qalloc.git
- Add
include
as include path to your project - Include
<qalloc/qalloc.hpp>
in your project
For examples, please refer to example.cpp
See benchmark.cpp for source code
- Windows 11 21H1
- Intel i7-10700K CPU @ 5.00GHz 16GB RAM
- Clang 14.0.6 c++17 x64 build
Benchmark | Time | CPU | Iterations | Speed |
---|---|---|---|---|
Std_Vector_String_Emplace_Reset | 1817 ns | 1800 ns | 373333 | ️ 207 it/ns |
Std_Vector_QAlloc_String_Emplace_Reset | 2257 ns | 2197 ns | 320000 | ️ 145 it/ns |
QAlloc_Vector_Std_String_Emplace_Reset | 313 ns | 311 ns | 2357895 | 7581 it/ns 🚀 |
QAlloc_Vector_String_Emplace_Reset | 521 ns | 516 ns | 1120000 | 2170 it/ns 🚀 |
Benchmark | Time | CPU | Iterations | Speed |
---|---|---|---|---|
Std_Vector_Int_Emplace_Reset | 703 ns | 711 ns | 1120000 | 1593 it/ns |
QAlloc_Vector_Int_Emplace_Reset | 110 ns | 112 ns | 6400000 | 57142 it/ns 🚀 |
Benchmark | Time | CPU | Iterations | Speed |
---|---|---|---|---|
Std_String_Creation | 0.206 ns | 0.203 ns | 1000000000 | 4.9B it/ns |
QAlloc_String_Creation | 1.63 ns | 1.61 ns | 407272727 | 0.25B it/ns ❌ |
Benchmark | Time | CPU | Iterations | Speed |
---|---|---|---|---|
Std_String_Append_Reset | 834 ns | 837 ns | 896000 | 1070 it/ns |
QAlloc_String_Append_Reset | 311 ns | 318 ns | 2357895 | 7414 it/ns 🚀 |
Benchmark | Time | CPU | Iterations | Speed |
---|---|---|---|---|
Std_Unordered_Map_Int_Int_Insert_Reset | 5623 ns | 5625 ns | 100000 | 17 it/ns |
QAlloc_Unordered_Map_Int_Int_Insert_Reset | 3436 ns | 3488 ns | 224000 | 64 it/ns 🚀 |
Benchmark | Time | CPU | Iterations | Speed |
---|---|---|---|---|
Std_List_Double_Emplace_Reset | 3960 ns | 3924 ns | 179200 | 45 it/ns |
QAlloc_List_Double_Emplace_Reset | 1940 ns | 1957 ns | 407273 | 208 it/ns 🚀 |
- Diagrams on how it works internally
- More tests on different memory patterns
- Compare to other pool allocators
- Better benchmark cases
- Full documentation
- Full multi-thread support
- c++20 constexpr
- Memory allocation visualization
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Alternatively, you can create feature requests on the open issues page.
Distributed under the Apache 2.0 License. See LICENSE
for more information.
yusing - [email protected]
Project Link: https://github.com/yusing/qalloc