Skip to content
Back

Subroutine optimization in assembly: Agner Fog's guide and critical C and C++ code

The post shares Agner Fog's PDF on optimizing subroutines in assembly language, with low-level techniques useful for tuning critical sections of C and C++ code.

By Wendelmaques Pereira · Updated today

Source: Guia de Agner Fog sobre otimização de sub-rotinas em assembly (agner.org). Text prepared with AI from this source.

What happened and what to do

The post shares Agner Fog's PDF, a author well known for performance work, on optimizing subroutines in assembly language. According to the post, the material covers low-level techniques aimed at tuning critical sections of programs written in C and C++.

For a company, the practical point is to identify which functions in C or C++ systems consume the most CPU time, such as data preprocessing routines, codecs or computation loops, and measure them before changing anything. With profiling and regression tests, it is possible to decide case by case whether to rewrite a section in assembly, adjust compiler options and data structures, or leave the code as it is. Hand-written assembly raises maintenance cost and requires testing on each target architecture, so the decision should rest on measurements.

How the consultancy can help

Performance diagnosis of critical C and C++ sections: profiling, identification of CPU bottlenecks, and cost comparison between compiler tuning, algorithm rewrites and assembly subroutines. Then a scoped implementation of the chosen changes, with regression tests and documentation.

Next step

If your system has critical C or C++ routines and you want to know whether assembly-level optimization is worth it, send a short description of the case: language, target architecture and where execution time concentrates. Wendelmaques will reply with a scoped proposal.

Let's assess your project

Wendelmaques Pereira

I reply with scope and a proposal.

WhatsApp

Looking for something else?Frequently asked questionsGuidesContact