Quantcast
Channel: Software Design - Medium
Browsing index pages (19 articles)
↧

Image may be NSFW.
Clik here to view.

Understanding Rust’s Trait Objects

Fat-pointers, Vtables, and dynamic dispatch in RustPhoto by Andrea Qoqonga on UnsplashThis article investigates how Rust handles dynamic dispatch using trait objects and vtables. We will also explore...

View Article


Image may be NSFW.
Clik here to view.

Compare the Assembly Generated for Static vs Dynamic Dispatch in Rust

Understand the differences between static and dynamic dispatch in RustTraits in Rust are similar to interfaces in other languages. Traits permit the implementation of a standard interface for multiple...

View Article


Image may be NSFW.
Clik here to view.

Rust Under the Hood

A deep dive into Rust internals and generated assemblyOur first book, Rust Under the Hood is available at Amazon.This comprehensive guide delves into Rust’s core mechanics by examining the assembly...

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

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 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.

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.

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.

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.

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.

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.

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.

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.

Translate C code to assembly language

Learn about mapping C function calls, loops and conditional statements to assemblyMapping from C to generic assembly codeLearn the basics of mapping from C to a generic assembly language. The following...

View Article

Image may be NSFW.
Clik here to view.

The myth of O(1) random access

In this series of articles, Emil Ernerfeldt argues that with large data structures, there is no such thing as an O(1) random access. The impact of processor caches results in approximately O(√N)...

View Article


Image may be NSFW.
Clik here to view.

Why software developers should care about CPU caches

The memory subsystem on modern computer systems has not kept pace with the increasing processor speed. This has resulted in processor designers adding very fast cache memory to reduce the penalty of...

View Article

Image may be NSFW.
Clik here to view.

Pattern matching in C++14

Pattern matching in C++ is an alternative to using if statements to control the logic flow. Pattern matching lets you organize the code as matching patterns and the statements to be executed when the...

View Article


Image may be NSFW.
Clik here to view.

Boost fiber in your code

OK, we are not giving you dietary advice. “Boost Fiber” is a library designed to provide very light weight thread (fiber) support in user mode. A single thread can support multiple fibers that are...

View Article

Image may be NSFW.
Clik here to view.

Map C switch and if statements to assembly code

This article covers the code generation for if-else and switch statements.Code generation for a switch statement (case values are in a narrow range)The code generated for a switch statement varies a...

View Article
Browsing index pages (19 articles)


Latest Images