-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Performance of invoke #9608
Comments
Ref #3440 ("inline invoke()") |
Just got a (possibly stupid in some way) idea while writing this issue. If the stagedfunction can be specialized based on value of a parameter, and if Doing it this way will likely have the issue when new method though... #265 |
....Sorry, I've glance through that huge list but apparently missed it............... |
Not only is invoke slow, but it also apparently produces a type-unstable result. e.g. g(x,y::Number) = y
g(x::Number,y) = x
g(x::Number,y::Number) = invoke(g, (Any,Number), x, y)
@inferred g(3,4)
ERROR: return type Int64 does not match inferred return type Any
in error(::String) at ./error.jl:21 I just got bitten by this. It is very tempting to use |
That's a fairly different issue.... |
Just doing issue browsing before merging the PR and noticed the comment above again. @stevengj It's caused by #18444 (comment). |
The performance of
invoke
is very poor even though the compiler already get as much information about the types as a normal function call during typeinf (in the case whentypeof
is used).I guess the compiler is not doing anything special about invoke now and treating it as a normal function?
Test done on latest master as of yesterday. Shouldn't be high priority (although invoke is actually used in a few sparse matrises functions and I'm not sure how performance critical are they...).
The text was updated successfully, but these errors were encountered: