~/talk

Hidden Overhead of a Function API

Talkat CppCon 2024 · on Wednesday, 2024-09-18· at 09:00· Cottonwood 8/9, 6700 North Gaylord Rockies Boulevard· [rust]
links:none on file
slides:none on file

Examines concrete assembly and microbenchmarks across Clang GCC and MSVC on ARM and x86 and shows how signature choices matter: returning by value usually beats output parameters (measured 25% overhead for an out-param case), wrappers like std::unique_ptr can force memory temps (one case is 3x slower), calling conventions and ABI rules explain stray loads and moves, a small lazy wrapper implementation restores RVO and eliminates the extra work, and all investigations use Compiler Explorer and real instruction counts.

AI-written summary · about

  1. 0:00Introduction
  2. 1:25Functions and performance
  3. 3:12Performance beyond benchmarks
  4. 7:06Return values vs output params
  5. 12:51Return by value and C++ abstractions
  6. 23:07Return value optimization deep dive
  7. 28:15Output parameters in practice
  8. 29:48Pass by value vs reference
  9. 34:52Perfect forwarding costs
  10. 35:54Non-trivial types and references
  11. 36:17Span and trivial types
  12. 39:30Empty params and ABI quirks
  13. 43:04Parameter order and registers
  14. 47:42Array pointer pitfalls
  15. 50:34Limiting arguments for speed
  16. 55:13Key takeaways
  17. 56:41Q&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.