~/talk

Dependency Injection Patterns: Efficiency and Usability

Talkat Meeting C++ 2023 · 2023-11-12..11-14· [frontend-architecture]
links:none on file
slides:none on file

Compares concrete outcomes: static polymorphism (templates + concepts) produces direct calls and inlining so it avoids runtime indirection on hot paths; indirect calls from virtual methods or std::function often add size and runtime cost unless link-time optimization or specific compiler heuristics remove them. Tests use gmock and mockable vector/mutex to prove behavior; examples include wrapping C APIs, a synchronized deque adapter, and experiments on x86_64/ARM with GCC Clang and MSVC at O3/-Os showing compiler-dependent differences.

AI-written summary · about

  1. 0:00Dependency injection in C++
  2. 1:05Why DI matters
  3. 3:56Domain requirements for DI
  4. 8:11Performance trade-offs
  5. 9:37Runtime polymorphism explained
  6. 13:39Code generation for virtual calls
  7. 20:33Advantages and limitations of runtime polymorphism
  8. 21:59Type erasure wrappers
  9. 26:15Performance overhead of polymorphic function wrappers
  10. 30:20Function pointers for DI
  11. 36:25Optimizing function pointers
  12. 37:49Runtime polymorphism optimizations
  13. 40:18Static polymorphism alternative
  14. 42:47Code generation for static poly
  15. 46:02Class templates for DI
  16. 49:43C++20 concepts for contracts
  17. 51:34Compile-time techniques combined
  18. 57:00Injecting functions without overhead
  19. 1:00:37Static polymorphism benefits
  20. 1:03:24Performance recommendations
  21. 1:04:28Q&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.