Hi, I'm Eric.

I’m an avid world traveler, photographer, software developer, and digital storyteller.

I help implement the Content Authenticity Initiative at Adobe.

Search Results

Optimize Rust code by avoiding panics

Found on 5 October 2023 via Mastodon 450

Via Rust tips: If you want your #Rustlang code to be fast and compact, avoid code that could panic.

Returning from a function instead of panicking is always going to optimize better.

Compiler Explorer: Sample code showing disassembly of return vs panic

If you’ve enjoyed this …

Subscribe to my free and occasional (never more than weekly) e-mail newsletter with my latest travel and other stories:

Or follow me on one or more of the socials: