~/talk

Why and How to Roll Your Own std::function Implementation

Talkat CppCon 2018 · 2018-09-23..09-28· [c-and-cpp]
name:Tom Poole
links:none on file
slides:none on file

Reimplements std::function inside JUCE with a vtable-style type eraser, benchmarks showing parity with libstdc++ and up to ~30% speed improvement when forcing stack storage, and explains why heap allocations cause audible glitches in audio threads. Adds small buffer optimization with selectable stack size, an option that fails to compile if a callable is too large providing a compile-time no-alloc guarantee, and discusses allocator-pooling and move-only alternative patterns (Folly/SG14 comparisons).

AI-written summary · about

  1. 0:00Introduction and motivation
  2. 3:39Why std::function matters
  3. 8:19Problems with std::function
  4. 10:51Implementing std::function
  5. 14:03Benchmarking performance
  6. 17:21Memory overhead analysis
  7. 19:32Optimizing with vtables
  8. 21:23Compile-time allocation safety
  9. 22:51Memory management with allocators
  10. 24:55Indirection and flexibility
  11. 27:07When to avoid type erasure
  12. 29:19Conclusion and takeaways
  13. 30:23Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.