Skip to content

Commit

Permalink
fix performance of #7714 by forcing use of Zip2{Any,Any}
Browse files Browse the repository at this point in the history
discovered using TRACE_INFERENCE. this was specializing Zip2 for
all method signatures processed by the reflective code.
  • Loading branch information
JeffBezanson committed Dec 7, 2014
1 parent d86d001 commit 052f54e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion base/replutil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ function showerror(io::IO, e::MethodError)
print(buf, " $(e.f.env.name)(")
first = true
right_matches = 0
for (arg, sigtype) in zip(e.args, method.sig)
for (arg, sigtype) in Zip2{Any,Any}(e.args, method.sig)
if first
first = false
else
Expand Down

2 comments on commit 052f54e

@ivarne
Copy link
Member

@ivarne ivarne commented on 052f54e Dec 8, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool fix!

Any lessons we can learn from this and put into the "Performance tips" section of the manual?

@JeffBezanson
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the general lesson is that reflective code can wreak havoc with julia's specialization mechanism. Specialization depends on the sparseness of interactions between types, but when you have code whose explicit purpose is to iterate over everything in the system that assumption is violated.

Please sign in to comment.