rnburn / Stackext
Licence: mit
Header-only C++ library for working with an extended stack
Stars: ✭ 27
Projects that are alternatives of or similar to Stackext
Heapinspector For Ios
Find memory issues & leaks in your iOS app without instruments
Stars: ✭ 1,819 (+6637.04%)
Mutual labels: performance, memory-allocation
Go Concurrency Test
Test the performance of Go's concurrency structures
Stars: ✭ 24 (-11.11%)
Mutual labels: performance
Webdriverio
Next-gen browser and mobile automation test framework for Node.js
Stars: ✭ 7,214 (+26618.52%)
Mutual labels: performance
Woocommerce Loadimpact
Scenarios for `loadimpact.com`, written against Liquid Web's WooCommerce sample data.
Stars: ✭ 17 (-37.04%)
Mutual labels: performance
Use Web Animations
😎 🍿 React hook for highly-performant and manipulable animations using Web Animations API.
Stars: ✭ 802 (+2870.37%)
Mutual labels: performance
Node Servertiming
📊 Generate Server-Timing headers interactively in NodeJS
Stars: ✭ 19 (-29.63%)
Mutual labels: performance
Pyopencl
OpenCL integration for Python, plus shiny features
Stars: ✭ 790 (+2825.93%)
Mutual labels: performance
Fast Elixir
💨 Writing Fast Elixir 😍 -- Collect Common Elixir idioms.
Stars: ✭ 924 (+3322.22%)
Mutual labels: performance
Haul Vs Reactnative
Testing the performance between React Native and Haul Packagers
Stars: ✭ 22 (-18.52%)
Mutual labels: performance
Werelogs
A logging library providing efficient raw logging in the form of JSON data.
Stars: ✭ 16 (-40.74%)
Mutual labels: performance
React Cool Inview
😎 🖥️ React hook to monitor an element enters or leaves the viewport (or another element).
Stars: ✭ 830 (+2974.07%)
Mutual labels: performance
Lazycache
An easy to use thread safe in-memory caching service with a simple developer friendly API for c#
Stars: ✭ 901 (+3237.04%)
Mutual labels: performance
Netcoreserver
Ultra fast and low latency asynchronous socket server & client C# .NET Core library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution
Stars: ✭ 799 (+2859.26%)
Mutual labels: performance
Listpool
Optimized allocation free implementation of IList using ArrayPool.
Stars: ✭ 25 (-7.41%)
Mutual labels: performance
Tvm
Open deep learning compiler stack for cpu, gpu and specialized accelerators
Stars: ✭ 7,494 (+27655.56%)
Mutual labels: performance
Ebpf exporter
Prometheus exporter for custom eBPF metrics
Stars: ✭ 829 (+2970.37%)
Mutual labels: performance
stackext
Small, header-only library for working with an extended stack. Like alloca, stackext provides a much faster alternative than the heap for allocating memory that doesn't need to persist beyond a function's scope. But, unlike alloca, stackext
- Doesn't risk causing a stack overflow. If an allocation can't fit into the extended stack, it falls back to heap allocation.
- Works with classes that have non-trivial constructors and destructors.
See How to make your C++ code faster with an extended stack and benchmarks for example usages.
Installation
sudo cp -r include/stackext /usr/local/include
Quick start
// Set aside 1KB of extended stack space per thread.
static thread_local stackext::stack_allocator ExtendedStack{1024};
static void example1(int n) {
// Make an allocator for this function's scope
stackext::scoped_allocator allocator{ExtendedStack};
// allocate a dynamic number of characters
// memory for s will be freed automatically when allocator's destructor is called
auto s = allocator.allocate<char>(n);
(void)s;
// allocator works with classes that have non-trivial constructors and
// destructors
struct A {
A(int x) { std::cout << "A: " << x << "\n"; }
~A() {
std::cout << "~A\n";
}
};
auto aptr = allocator.allocate<A>(3, 97);
(void)aptr;
// allocations larger than the amount of stack space reserved will fall back
// to using the heap
auto bigdata = allocator.allocate<char>(1024 * 1024);
(void)bigdata;
// we can nest usages of scoped_allocator
example2();
// with linear_allocator, we can use scoped_allocator with standard C++ containers
std::vector<int, stackext::linear_allocator<int>> v(stackext::linear_allocator<int>{allocator});
v.push_back(1);
v.push_back(2);
v.push_back(3);
}
static void example2() {
stackext::scoped_allocator allocator{ExtendedStack};
struct B {
B() { std::cout << "B\n"; };
};
auto bptr = allocator.allocate<B>(5);
(void)bptr;
}
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].