The cost of abstraction: Why C++ still matters in 2025? In a world full of frameworks, we’ve started forgetting what’s really happening underneath. This week, I profiled a service built using modern frameworks. Everything looked fine until I realized that 50% of the CPU time was being spent in string copies which was all hidden behind abstractions. Rewriting that component in C++ and focusing on memory locality cut latency by 30%. Abstractions make us faster but only until we forget what they’re hiding. !! Understanding low-level behaviour (cache lines, copies, allocation) is still one of the most valuable skills in 2025 !! Q: Do you still dive into disassembly or profiler data once in a while? [ #CPlusPlus #Performance #Optimization #LowLevelProgramming ]
C++ still matters in 2025: The cost of abstraction
More Relevant Posts
-
A Deep Performance Analysis: Traditional for Loops vs Modern C++ Ranges. ======================= One of the most common questions among C++ developers today is whether the new C++ Ranges feature truly improves performance compared to the traditional for loops that have been used for decades. To answer this, we will explore both from multiple technical perspectives — including execution time in milliseconds, compiler optimizations, code clarity, and real-world usage recommendations. Read more ... https://lnkd.in/dpXYkMd9
To view or add a comment, sign in
-
-
C++ tips: writing a simple equivalent of std::ranges::to From C++20, we have the range library, allowing us to compose easily different algorithms. From C++23, we have std::ranges::to, which enables us to convert a range into a given container. Most people are not using a C++23 compiler, and maybe not even a C++20 one. Here is a straightforward implementation, we can complete it by adding safety through concepts or sfinae or static_assert. We can also complete it to support even more types. I know there was much debate on the usage of the std::ranges library, with some saying that, for most cases, a simple raw loop is more readable than using it. However, for the case of converting a container into another one, I really like the pipe approach. What do you think? https://lnkd.in/eaeNc_tt
To view or add a comment, sign in
-
-
From Code to Execution - The Journey of a C Program 💥 Ever wondered what happens after you hit “Run”? 👀 Your C code goes on an adventure before reaching the CPU! 🧠 1️⃣ Source Code (.c) → Your handwritten logic. 2️⃣ Preprocessing (.i) → Expands macros & headers. 3️⃣ Compilation (.s) → Converts to Assembly. 4️⃣ Assembly (.o) → Turns into machine code. 5️⃣ Linking (exe) → Merges everything to form hello. 6️⃣ Execution → Loader → RAM → CPU runs it ⚡ ✨ Pro Tip: Peek behind the curtain with gcc -save-temps hello.c Because real coders don’t just run programs - they understand how they run. #CProgramming #CodeToExecution #CompilerJourney #EmbeddedSystems #ProgrammingBasics
To view or add a comment, sign in
-
-
One blog, 11k words, unlock the art of blazing-fast LLM inference from scratch using pure C++ and CUDA without libraries.
To view or add a comment, sign in
-
-
💡 Did You Know? Rearranging Your C Structs Can Save Memory! Here’s why 👇 In C, the order of struct members isn’t just a detail — it directly affects memory usage. On 32-bit systems, compilers add padding bytes between members for data alignment. ⚠️ Poor ordering = wasted memory. 🔍 Why It Matters 🧠 Embedded systems: Save precious RAM 🚀 High-performance code: Improve cache efficiency 💾 Large datasets: Reduce total memory footprint ✅ Key Takeaway The order of your struct fields matters. Always check with sizeof() and reorder for optimal alignment. 👀 Like this tip? 💬 Comment your favorite C optimization hack 🔁 Share to help others write leaner, smarter code! #CProgramming #MemoryOptimization #EmbeddedSystems #SoftwareEngineering #CodingTips #Performance
To view or add a comment, sign in
-
Rust’s Lifetimes vs Manual Memory in C In C, developers manually manage memory using malloc() and free(), which gives full control but also introduces dangerous risks like dangling pointers, memory leaks, and use-after-free errors. Rust eliminates these issues through its lifetime system, which the compiler uses to track how long each reference remains valid. This means memory safety is guaranteed at compile time, not runtime, without requiring a garbage collector. Lifetimes ensure that no reference outlives the data it points to, making bugs that crash systems in C impossible in safe Rust. The result is C-level performance with mathematically proven safety a balance that has redefined systems programming.
To view or add a comment, sign in
-
Char Type: The character types are integer types; three common character types are 'char', 'signed char', and 'unsigned char'. The C++ standard guarantees that their size is at least 8 bits, but can be larger on different machines. Unlike 'signed char' and 'unsigned char', the char type value can be encoded as signed or unsigned. The char type signedness depends on the compiler and the targeting platform. ARM and PowerPC -> the typical default is unsigned. x86 and x64 -> the typical default is signed. However, they are considered separate types. Reference: [1] https://lnkd.in/dxnnWTQp
To view or add a comment, sign in
-
-
𝐂# 𝐒𝐡𝐚𝐫𝐩 𝐜𝐨𝐝𝐞 𝐞𝐱𝐞𝐜𝐮𝐭𝐢𝐨𝐧 𝐩𝐫𝐨𝐜𝐞𝐬𝐬 Understanding how a C Sharp code executes is a key concept. Here I tried to give an overview of that. C# Source Code (.cs) ↓ C# Compiler ↓ CIL + Metadata → Assembly (.dll / .exe) ↓ CLR loads the assembly ↓ JIT Compiler → Native Machine Code ↓ CPU executes The execution process of C Sharp code can be classified into two major sections. 𝐂𝐨𝐦𝐩𝐢𝐥𝐞 𝐭𝐢𝐦𝐞 𝐞𝐱𝐞𝐜𝐮𝐭𝐢𝐨𝐧 At first the whole code is checked from first to last for errors. If any error is detected then it is reported on the compile time. Then the whole code is converted into 𝐂𝐈𝐋 (𝐂𝐨𝐦𝐦𝐨𝐧 𝐈𝐧𝐭𝐞𝐫𝐦𝐞𝐝𝐢𝐚𝐭𝐞 𝐋𝐚𝐧𝐠𝐮𝐚𝐠𝐞) which is platform independent. Then the compiler compiles the whole code into an 𝐀𝐬𝐬𝐞𝐦𝐛𝐥𝐲 𝐟𝐢𝐥𝐞 (.𝐞𝐱𝐞 /. 𝐝𝐥𝐥) which includes metadata. This asassembly file contains information about data types, methods and properties used in C# code. 𝐑𝐮𝐧 𝐭𝐢𝐦𝐞 𝐞𝐱𝐞𝐜𝐮𝐭𝐢𝐨𝐧 During the runtime, 𝐉𝐈𝐓 (𝐉𝐮𝐬𝐭 𝐈𝐧 𝐓𝐢𝐦𝐞) 𝐜𝐨𝐦𝐩𝐢𝐥𝐞𝐫 of 𝐂𝐋𝐑 (𝐂𝐨𝐦𝐦𝐨𝐧 𝐋𝐚𝐧𝐠𝐮𝐚𝐠𝐞 𝐑𝐮𝐧𝐭𝐢𝐦𝐞) uses the metadata and convert the 𝐂𝐈𝐋 into native machine code. then this machine code is executed by the OS. The machine code is stored on in memory cache to avoid re - compilation.
To view or add a comment, sign in
-
C++ tips: Another simple way to synchronize threads. After introducing notify_one and wait for atomics, C++20 brings latch and barrier. Today, we will focus on the latch. Its main objective is to know when one or several asynchronous tasks have finished their work. For example, we can imagine several threads computing one part of the full calculation, and when all of them have finished, the main thread aggregates them and serializes them. Note: to synchronize the output, I used std::osyncstream, also provided by C++20 Note 2: Adama ZOUMA advised me rightfully to use a reference instead of a pointer, it's done :p. Documentation of latch: https://lnkd.in/e4WRPtSC Compiler Explorer: https://lnkd.in/eW9TmrJh
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
Yes, I certainly looks each time, for even small loops to large algorithms. Profiling gives very good view of memroy access w.r.t. source program ! Which tools you use daily for profiling ???