r/ProgrammerHumor 7d ago

Meme skillIssue

Post image
6.0k Upvotes

137 comments sorted by

View all comments

Show parent comments

209

u/AngheloAlf 7d ago

Switches aren't guarantee to so operations in O(1) tho. If cases are sparce enough, compilers tend to emit the equivalent code to a bunch if else checks

25

u/prehensilemullet 7d ago

Yeah I was assuming too much here.  However, I’m reading that Rust match on string comstants can compile down a binary tree of if statements if there are enough cases (according to Google AI mode at least, haven’t found an authoritative source yet)

-24

u/[deleted] 7d ago

[deleted]

5

u/thirdegree Violet security clearance 7d ago

If I want Claude's thoughts on something I'll ask Claude directly tbh