-
Notifications
You must be signed in to change notification settings - Fork 35
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
optimization of "pass-through" varargs methods #5
Comments
A workaround for now is to add extra methods to cause specialization, e.g.
|
Thanks, trying this out now. Two questions:
julia> struct Foo{X,F}
x::X
f::F
end
julia> (foo::Foo{Int})(args...) = foo.f(args...)
julia> (foo::Foo{Int})(x) = invoke(foo, Tuple{Vararg{Any}}, x)
julia> Foo(1, sin)(1)
ERROR: StackOverflowError:
Stacktrace:
[1] (::Foo{Int64,typeof(sin)})(::Int64) at ./REPL[3]:0
[2] (::Foo{Int64,typeof(sin)})(::Int64) at ./REPL[3]:1 (repeats 26666 times) EDIT: Furthermore: julia> struct Foo{F}
x
f::F
end
julia> (foo::Foo)(args...) = foo.f(args...)
julia> (foo::Foo)(a) = invoke(foo, Tuple{Vararg{Any}}, a)
julia> @code_typed Foo(1, sin)(1)^C
julia> Foo(1, sin)(1)
[1] 52977 segmentation fault julia7 Weirdly, the bug goes away if we get rid of the |
closed by #41 |
Cassette relies heavily on varargs functions to pass through arguments with "no" overhead; until JuliaLang/julia#5402 is fixed, the performance of contextual code execution will be trash.
The text was updated successfully, but these errors were encountered: