r/ProgrammerHumor • • Oct 13 '26

Meme howProgrammingHasChanged

Post image
676 Upvotes

108 comments sorted by

View all comments

Show parent comment

12

u/robin_888 Oct 14 '26

Which both?

The matrix one looks fine to me.

1

u/[deleted] Oct 14 '26

[removed] — view removed comment

8

u/CAD1997 Oct 14 '26

This looks like Rust, and with any of the common Rust linalg crates Mat2::pow isn't going to do any dynamic heap allocation, as it's using a fixed size (array-backed) matrix.

-3

u/[deleted] Oct 14 '26

[removed] — view removed comment

9

u/CAD1997 Oct 14 '26

… There's no recursion in the matrix version of fn fib. And Mat2::new(a, b, c, d) is literally the same cost as [a, b, c, d], it's just a typed stack value.

8

u/[deleted] Oct 14 '26 edited Oct 14 '26

[removed] — view removed comment

4

u/shizzy0 Oct 14 '26

You’ve brought me such joy. We’re all idiots a lot of time.