Rust Performance Resources

A curated list of resources for optimizing code, with a focus on Rust. General Rust Specific The Rust Performance Book (great starting point for beginners and those new to Rust) How to avoid bounds checks in Rust (without unsafe!) Performance Cheat Sheets Latency Numbers Every Programmer Should Know Bit Twiddling Hacks Open Source Books Algorithms for Modern Hardware Performance Analysis and Tuning on Modern CPUs Memory Array of Structs vs. Struct of Arrays Data alignment for speed: myth or reality?...

14 September 2024 · 1 min · 156 words · Saveliy Yusufov

From FFTs to Quantum Simulations: The Butterfly Connection

Introduction Today, I want to bring your attention to the butterfly diagram. By the end of this post, I hope to show you that this stunning visualization also gives you almost everything you need to know in order to implement a quantum state simulator and the Fast Fourier Transform (FFT). For a while I have been working on a quantum state simulator, Spinoza. During the implementation and performance tuning of the simulator, I encountered a memory access pattern that comes up often in the context of Digital Signals Processing (DSP)....

24 July 2024 · 11 min · 2212 words · Saveliy Yusufov

Python Truthiness and Equivalence Classes: A Mathematical Perspective

Introduction Recently, I ran into a bug in Rust while I was checking if bits were set in a u64. fn is_bit_set(n: u64, k: usize) -> bool { n & (1 << k) == 1 } Let’s run it on some input and see what happens. fn is_bit_set(n: u64, k: usize) -> bool { (n & (1 << k)) == 1 } fn main() { let n = 51; for k in 0....

30 November 2023 · 5 min · 1013 words · Saveliy Yusufov

Recv

Intro to the recv system call, and a common mistake beginners make when employing recv.

10 February 2021 · 2 min · 314 words · Saveliy Yusufov

Homomorphism Inverse to Inverse

A beautiful proof and elegant proof covered in Abstract Algebra.

13 January 2021 · 1 min · 132 words · Saveliy Yusufov