C++ Performance Tips: Cutting Down on Unnecessary Objects

Prithvi Okade & Kathleen Baker

⏱ 60 minute session
beginner
intermediate
14:00-15:00, Wednesday, 25th June 2025

In C++, unnecessary temporary object creation can lead to costly runtime operations, increased code execution, and higher memory usage. Luckily this can be improved! This talk investigates common scenarios that result in the creation of temporary objects, demonstrated through code examples. We will then explore strategies to reduce the creation of such objects with techniques like explicitly moving objects, passing objects by reference, leveraging lightweight classes like std::string_view and std::span, using functions like reserve and emplace, and more. Join us to learn how to optimize your code’s performance and adopt better practices.


🏷 best practices
🏷 optimizations
🏷 STL
🏷 compile-time

Prithvi Okade

I am currently a software engineer at Microsoft and have been there for about 2 years. I joined Microsoft after completing my undergraduate degree at Carnegie Mellon University's School of Computer Science. At Microsoft, I work on the Edge team, primarily developing AI tooling for business clientele (like sidebar Copilot).

LinkedIn

Kathleen Baker

I am a software engineer at Microsoft, currently working on the Edge browser team. I joined Microsoft after completing my undergraduate degree at the University of Alberta.