C++ vs Rust: which is faster?

I ported some Advent of Code solutions from C/C++ to Rust, and used the opportunity to compare performance. When I couldn't explain why they performed differently, I had no choice but to disassemble both and look at what the codegen was like!

00:00 What is Advent of Code?
00:48 Python vs Rust
01:19 Interpreters vs JITs
03:03 Buffered I/O
04:27 Day 18 Benchmarks
05:00 How does the code feel?
06:49 Day 19 Benchmarks
07:17 Profiling, disassembling & decompiling
08:14 x86 assembly crash course
12:44 Suddenly SIMD
15:52 Day 19 mystery solved
16:40 Register allocation is hard
18:08 Switching calling conventions
18:31 2x3 != 3x2
19:12 Thanks & sponsored segment

Rust & C++ sources for day 19: https://gist.github.com/fasterthanlime/b2e261c3d1492171d6a46edf620a0728

Speculation in JavaScriptCore: https://webkit.org/blog/10308/speculation-in-javascriptcore/

If you liked what you saw, please support my work!

Github logo Donate on GitHub Patreon logo Donate on Patreon

Another random video

video cover image
We need to talk about Dropout

Let's talk about big TV and movie studios. About the life and death of CollegeHumor, about what makes Dropout interesting, and how their video platform could be improved!

Watch now

You can watch more videos over there

Looking for the homepage?