-- Swarnim Arun -- Rust Engineeer!?
Link: swarnimarun.github.io/rust-perf-101
Not all small changes are small in terms of performance.
Often people don't really know or understand what the cost of the code they are writing is, and this leads to badly written code that could have been far more optimized.
Further they may also make understanding the performance cost harder because of assumptions one might make about a programmming language compiler optimizations.
For example a web app may not care about compute performance of the code but rather the latency or in case of serverless the cost of cold starts.
Consicious thinking about performance and understanding are the most impactful things you can do to increase the performance of your code in general.
fn main() { let mut edit_value_in_place = vec![1, 3, 5]; let move_value = vec![1, 3, 5]; // so which one is faster? edit_in_place(&mut edit_value_in_place); let move_value = use_move(move_value); }
fn main() { let s1 = String::from("this is a string"); let s2 = String::from("smallstring"); // so which one is faster? // the better code let s3: String = [s1, s2].concat(); // or this code? let s3: String = { let mut s1 = s1; s1.push_str(&s2); s1 }; }