Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inlining kwarg functions decreases performance #16926

Closed
cstjean opened this issue Jun 14, 2016 · 3 comments
Closed

Inlining kwarg functions decreases performance #16926

cstjean opened this issue Jun 14, 2016 · 3 comments
Labels
keyword arguments f(x; keyword=arguments) performance Must go faster

Comments

@cstjean
Copy link
Contributor

cstjean commented Jun 14, 2016

I know that keyword arguments are slow (#9551), but I was surprised that not only are they not properly inlinable, @inline is actually slower and allocates more. On Julia 0.4.5

plus(x) = x+x
plus2(args...; kwargs...) = plus(args...; kwargs...)
@inline plus3(args...; kwargs...) = plus(args...; kwargs...)

function pluser2()
    for _ in 1:1000 plus2(2) end
end

function pluser3()
    for _ in 1:1000 plus3(2) end
end

# After warming up...
@time pluser2()
> 0.000584 seconds (3.00 k allocations: 140.781 KB)

@time pluser3()
> 0.001023 seconds (5.00 k allocations: 172.031 KB)
@tkelman tkelman added the performance Must go faster label Jun 14, 2016
@KristofferC
Copy link
Member

Dup of #12219.

@yuyichao
Copy link
Contributor

Not really. #12219 is about inlining heuristics and this is not.

@yuyichao yuyichao reopened this Jan 26, 2017
@JeffBezanson JeffBezanson added the keyword arguments f(x; keyword=arguments) label Jul 20, 2017
@KristofferC
Copy link
Member

julia> @time pluser2()
  0.000001 seconds (4 allocations: 160 bytes)

julia> @time pluser3()
  0.000002 seconds (4 allocations: 160 bytes)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keyword arguments f(x; keyword=arguments) performance Must go faster
Projects
None yet
Development

No branches or pull requests

5 participants