Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
undefined | Better HN
story
0 points
amelius
6mo ago
0 comments
Share
But if you explicitly handle exceptions using IF statements then that's overhead too, right?
0 comments
default
newest
oldest
arbitrandomuser
6mo ago
yes but i think branch prediction essentialy makes them zero overhead
neonz80
6mo ago
That's a different type of overhead than having unwind tables. With exceptions you wouldn't need a branch after each function call at all.
amelius
OP
6mo ago
But a branch that is (almost) never taken has an overhead close to the overhead of a NOP instruction, which may be negligible on modern architectures.
neonz80
6mo ago
The CPU can not remember an infinite number of branches. Also, many branches will increase code size. With exceptions the unwind tables and unwind code can be placed elsewhere and not take up valuable L1 cache.
1 more reply
j
/
k
navigate · click thread line to collapse