Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
amelius
· 1y ago · 0 comments
But if you explicitly handle exceptions using IF statements then that's overhead too, right?
Comments
[–]
arbitrandomuser
1y ago
yes but i think branch prediction essentialy makes them zero overhead
[–]
neonz80
1y 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
1y 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
1y 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.