# Renato Athaydes - How to write fast Rust code (Highlights) ![rw-book-cover|256](https://readwise-assets.s3.amazonaws.com/static/images/article3.5c705a01b476.png) ## 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.