Qalloc Save Abandoned

A quick pool allocator for c++ with type info and gc support

Project README

Contributors Forks Stargazers Issues Size MIT License


Logo

QAlloc

A quick pool allocator for c++ with type info and gc support
Explore the docs »

View Demo · Report Bug · Request Feature

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Benchmark Results
  5. Roadmap
  6. Contributing
  7. License
  8. Contact

About The Project

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.

Features:

  • Header only
  • Type-aware memory management
  • Garbage collection
  • Dynamic pool size

Requirements

  • Compiler that supports c++ 11 or later

(back to top)

Getting Started

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.

Prerequisites

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)

Installation

This is a header-only library. Doesn't require any other dependencies.

  1. Clone the repo
    git clone https://github.com/yusing/qalloc.git
    
  2. Add include as include path to your project
  3. Include <qalloc/qalloc.hpp> in your project

(back to top)

Usage

For examples, please refer to example.cpp

(back to top)

Benchmark Results

See benchmark.cpp for source code

Running Platform:

  • Windows 11 21H1
  • Intel i7-10700K CPU @ 5.00GHz 16GB RAM
  • Clang 14.0.6 c++17 x64 build

String vector emplace and reset

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 🚀

Int vector emplace and reset

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 🚀

String creation

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 ❌

String append and reset

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 🚀

unordered_map<int, int> insert and reset

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 🚀

list<double> emplace and reset

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 🚀

(back to top)

Roadmap

  • 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).

(back to top)

Contributing

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!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Alternatively, you can create feature requests on the open issues page.

(back to top)

License

Distributed under the Apache 2.0 License. See LICENSE for more information.

(back to top)

Contact

yusing - [email protected]

Project Link: https://github.com/yusing/qalloc

(back to top)

Open Source Agenda is not affiliated with "Qalloc" Project. README Source: yusing/qalloc
Stars
72
Open Issues
1
Last Commit
1 year ago
License

Open Source Agenda Badge

Open Source Agenda Rating