Basic usage of PMRs for better performance
summary
Shows concrete payoff: use std::pmr to replace many small heap calls with a stack-backed slab or pooled blocks and cut allocation overhead; monotonic_buffer_resource gives bump-pointer speed for short-lived builds, pool_resource reuses fixed-size blocks for hot data, and the library falls back to new_delete_resource when exhausted. Notes gotchas: containers must not outlive the naked resource pointer and strings must be pmr::string to forward allocations. Cites real wins in XML parsing and game code.
AI-written summary · about
chapters (14)
- 0:00PMRs introduction
- 1:05Memory allocators overview
- 8:57C++ allocator support
- 10:44PMRs in C++17
- 11:52Polymorphic memory resources
- 18:59Standard PMR types
- 20:23Monotonic buffer resource
- 26:10Pool resource use
- 32:18PMR usage scenarios
- 39:38Arena allocation advanced
- 44:00jemalloc overview
- 51:20PMRs vs jemalloc
- 57:10Conclusions
- 1:03:22Q&A
related talks
01h 00mMemory Resources in a Heterogeneous World
51mUnderstanding Allocator Impact on Runtime Performance in C++
27m“From security to performance to GPU programming..."
01h 00mBringing Existing Code to CUDA Using constexpr and std::pmr
49mMaking Allocators Work, Part I
59mPerformance matters - new tricks for old dogs
01h 01mReal-time Programming with the C++ Standard Library
27mOptimizing Ruby's Memory Layout
