-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
performanceMust go fasterMust go faster
Description
I notice a missing optimization: try foo(); finally; end is not optimized to foo(). For example, look at @code_native foo(3) for foo(x) = try; return x+1; finally; end — there is a whole bunch of overhead (_ijl_excstack_state, _ijl_enter_handler, _sigsetjmp, …) compared to x+1.
I noticed this because (related to #55754) I was looking at print(io, x) performance on IOBuffers. The fallback for print(io, x) is defined as:
function print(io::IO, x)
lock(io)
try
show(io, x)
finally
unlock(io)
end
return nothing
endbut the default lock(io) and unlock(io) methods do nothing. So, on an IOBuffer at least, this whole function should be optimized to just (show(io, x); nothing), but it isn't.
oscardssmith and jariji
Metadata
Metadata
Assignees
Labels
performanceMust go fasterMust go faster