I've been noticing the same problem recently. This happens on 0.3, too.

--Tim

On Thursday, August 28, 2014 06:30:19 AM Simon Kornblith wrote:
> It doesn't look like the first snippet is inlining hash(p, zero(Uint)) to
> me. Rather, it looks like that code isn't specialized on the input
> argument. There's still only one call outside of the call to jl_box_uint64
> and no other work being done, so it can't really be calling hash twice, and
> it's making the call via jl_apply_generic rather than directly. I'm not
> sure why it wouldn't be specialized, but it seems likely to be an issue
> with @code_llvm rather than the compiler.
> 
> Simon
> 
> On Thursday, August 28, 2014 6:21:17 AM UTC-4, Steven G. Johnson wrote:
> > Interesting.   Defining foo(x, y=0) is supposed to be equivalent to
> > defining foo(x, y) and foo(x)=foo(x,0), but it looks like the latter form
> > triggers inlining and the former does not.     The latter form is more
> > common in older Julia code because the former syntax was only added in
> > Julia 0.2.
> > 
> > However, I can't reproduce it on simpler examples; in most cases that I
> > try, the two definition forms produce the same code.

Reply via email to