Quantcast
Channel: Software Design - Medium
Browsing latest articles
Browse All 16 View Live

Image may be NSFW.
Clik here to view.

Pure functions in C++

Declare a function to be side-effect freeC++ is not a functional programming language. Functions causing side-effects is the norm. If a compiler does not see the body of a function, it assumes that the...

View Article



Image may be NSFW.
Clik here to view.

Tail Call Optimization in C++

Eliminating the last function call and converting a recursive function into a loop based functionExamining the translation of simple examples of C++ code into assembly can be very instructive in...

View Article

Image may be NSFW.
Clik here to view.

C++ Lambda Under the Hood

Understand the closure generated from a lambda expressionLambda expressions in C++ let developers define anonymous functions that can be used to inject code. Lambda expressions are more than just...

View Article

Image may be NSFW.
Clik here to view.

likely — unlikely directives

likely — unlikely directivesAssisting the compiler in optimizing if conditionsA look at the Linux kernel code will show many if conditions enclosed in likely and unlikely macros. These macros invoke...

View Article

Image may be NSFW.
Clik here to view.

Auto-vectorize C and C++ code

Auto-vectorization of for loops results in significant performance improvementDevelopers can take advantage of built-in auto-vectorization support in GCC. Let’s explore vectorization with the GCC 11.2...

View Article


Image may be NSFW.
Clik here to view.

Assembly code generated from Rust for parameter passing

Understand the assembly code generated for passing a parameter by value, reference, Box, Rc, and ArcHere we will be exploring the performance implications of the passing the self parameter by value,...

View Article

Image may be NSFW.
Clik here to view.

Rust enum-match code generation

Understand the generated assembly code for enum discriminated unionsMatching an enum and associated fieldsEnums in Rust are discriminated unions that can save one of the multiple variants. The enum...

View Article

Image may be NSFW.
Clik here to view.

Rust to assembly: Arrays, Tuples, Box, and Option handling

Map the Rust array, tuple, Box, and Option to assembly. See how the Rust compiler inlines functions.We have already seen how Rust handles enums under the hood. We also looked at the code generation for...

View Article


Image may be NSFW.
Clik here to view.

Map Rust vector iteration to assembly

Learn how the compiler optimizes iteration for different vector lengthsVectors in Rust contain a pointer to a heap vector buffer ( buf) and a length ( len). The vector buffer is a pointer to a buffer...

View Article


Image may be NSFW.
Clik here to view.

Rust bool vector to a string slice vector

Understand the assembly code for a Vec<bool> to Vec<'static str> transformation.We have already looked at assembly code generated for a vector iteration. We will build on that knowledge to...

View Article
Browsing latest articles
Browse All 16 View Live




Latest Images