Thanks Tim for leading me to this thread.
On Friday, August 26, 2016 at 11:06:33 AM UTC-3, Kevin Liu wrote:
>
> Nice video recommendation, Yichao. Thanks.
>
> On Saturday, April 2, 2016 at 1:16:07 PM UTC-3, Yichao Yu wrote:
>>
>> On Sat, Apr 2, 2016 at 10:26 AM, Cedric St-Jean
Nice video recommendation, Yichao. Thanks.
On Saturday, April 2, 2016 at 1:16:07 PM UTC-3, Yichao Yu wrote:
>
> On Sat, Apr 2, 2016 at 10:26 AM, Cedric St-Jean > wrote:
> >
> >> Therefore there's no way the compiler can rewrite the slow version to
> the
> >> fast
Thanks for your relies. I'm starting to understand some of this now.
In particular, I'm learning there are many aspects to dynamic dispatch.
Also worth noting the difference between:
if isa(features[i], A)
retval += evaluate(features[i]::A)
elseif isa(features[i], B)
retval +=
On Apr 4, 2016 1:36 PM, "Cedric St-Jean" wrote:
>
> I'm not a compiler dev, but here's how I understand it:
>
Sorry forgot to reply
>
> On Sunday, April 3, 2016 at 6:32:17 PM UTC-4, Greg Plowman wrote:
>>
>> It seems to me that slowness of dynamic dispatch and type
Thanks for your replies.
I'm sorry to trouble you again, but I'm still confused about general
concepts.
It seems to me that slowness of dynamic dispatch and type instability are
orthogonal.
I mean is dynamic dispatch inherently slow, or is it slow because it
involves type instability?
On Sat, Apr 2, 2016 at 10:53 PM, Cedric St-Jean wrote:
> That's actually a compiler bug, nice!
>
> abstract Feature
>
> type A <: Feature end
> evaluate(f::A) = 1.0
>
> foo(features::Vector{Feature}) = isa(features[1], A) ?
> evaluate(features[1]::A) :
That's actually a compiler bug, nice!
abstract Feature
type A <: Feature end
evaluate(f::A) = 1.0
foo(features::Vector{Feature}) = isa(features[1], A) ?
evaluate(features[1]::A) : evaluate(features[1])
@show foo(Feature[A()])
type C <: Feature end
evaluate(f::C) = 100
@show
Thanks Cedric and Yichao.
This makes sense that there might be new subtypes and associated
specialised methods. I understand that now. Thanks.
On my machine (v0.4.5 Windows), fast() and pretty_fast() seem to run in
similar time.
So I looked as @code_warntype as Yichao suggested and get the
On Saturday, April 2, 2016 at 5:39:45 PM UTC-4, Greg Plowman wrote:
>
> Cedric,
> On my machine fast() and pretty_fast() run in the roughly the same time.
> Are you sure pre-compiled first?
>
Yep. I'm using @benchmark on Julia 0.4.5 on OSX, and the time difference is
definitely > 2X.
>
>
On Sat, Apr 2, 2016 at 5:39 PM, 'Greg Plowman' via julia-users
wrote:
> Cedric,
> On my machine fast() and pretty_fast() run in the roughly the same time.
> Are you sure pre-compiled first?
>
> Yichao,
>>
>> The compiler has no idea what the return type of the third
Cedric,
On my machine fast() and pretty_fast() run in the roughly the same time.
Are you sure pre-compiled first?
Yichao,
> The compiler has no idea what the return type of the third one so this
> version is still type unstable and you get dynamic dispatch at every
> iteration for the floating
I tried that, but it has no impact on performance, in either pretty_fast or
slow. I don't understand why...
retval += x::Float64
On Saturday, April 2, 2016 at 4:42:01 PM UTC-4, Matt Bauman wrote:
>
> Perhaps a simpler solution would be to just assert that `evaluate` always
> returns a
Perhaps a simpler solution would be to just assert that `evaluate` always
returns a Float64? You may even be able to remove the isa branches in that
case, but I'm not sure how it'll compare.
On Saturday, April 2, 2016 at 4:34:09 PM UTC-4, Cedric St-Jean wrote:
>
> Thank you for the detailed
Thank you for the detailed explanation. I tried it out:
function pretty_fast(features::Vector{Feature})
retval = 0.0
for i in 1 : length(features)
if isa(features[i], A)
x = evaluate(features[i]::A)
elseif isa(features[i], B)
x =
On Sat, Apr 2, 2016 at 12:16 PM, Tim Wheeler wrote:
> Thank you for the comments. In my original code it means the difference
> between a 30 min execution with memory allocation in the Gigabytes and a few
> seconds of execution with only 800 bytes using the second
Thank you for the comments. In my original code it means the difference
between a 30 min execution with memory allocation in the Gigabytes and a
few seconds of execution with only 800 bytes using the second version.
I thought under-the-hood Julia basically runs those if statements anyway
for
On Sat, Apr 2, 2016 at 10:26 AM, Cedric St-Jean wrote:
>
>> Therefore there's no way the compiler can rewrite the slow version to the
>> fast version.
>
>
> It knows that the element type is a Feature, so it could produce:
>
> if isa(features[i], A)
> retval +=
> Therefore there's no way the compiler can rewrite the slow version to the
> fast version.
It knows that the element type is a Feature, so it could produce:
if isa(features[i], A)
retval += evaluate(features[i]::A)
elseif isa(features[i], B)
retval += evaluate(features[i]::B)
else
On Fri, Apr 1, 2016 at 9:56 PM, Tim Wheeler wrote:
> Hello Julia Users.
>
> I ran into a weird slowdown issue and reproduced a minimal working example.
> Maybe someone can help shed some light.
>
> abstract Feature
>
> type A <: Feature end
> evaluate(f::A) = 1.0
>
>
Hello Julia Users.
I ran into a weird slowdown issue and reproduced a minimal working example.
Maybe someone can help shed some light.
abstract Feature
type A <: Feature end
evaluate(f::A) = 1.0
type B <: Feature end
evaluate(f::B) = 0.0
function slow(features::Vector{Feature})
retval =
20 matches
Mail list logo