# Renato Athaydes - How to write fast Rust code (Highlights) ![rw-book-cover|256](https://readwise-assets.s3.amazonaws.com/static/images/article3.5c705a01b476.png) ## Metadata **Cover**:: https://readwise-assets.s3.amazonaws.com/static/images/article3.5c705a01b476.png **Source**:: #from/readwise **Zettel**:: #zettel/fleeting **Status**:: #x **Authors**:: [[Renato Athaydes]] **Full Title**:: How to write fast Rust code **Category**:: #articles #readwise/articles **Category Icon**:: 📰 **URL**:: [renato.athaydes.com](https://renato.athaydes.com/posts/how-to-write-fast-rust-code.html) **Host**:: [[renato.athaydes.com]] **Highlighted**:: [[2021-08-22]] **Created**:: [[2022-09-26]] ## Highlights - Naively printing to stdout directly - Allocating small Vectors on the stack with smallvec - Iterating bytes of str instead of chars - Using a faster hashing function like ahash significantly improves the performance of map lookups. - Profile Guided Optimisation (PGO) is a way for the compiler to get information about how a program is likely to be executed so that it can try to perform more specific optimisations based on that when it re-compiles the same program - Another tool available to Rust developers to find out hotspots in their applications that require optimisations is flamegraphs.