On Tuesday, February 18, 2014 2:26:11 PM UTC-6, Tim Holy wrote:
>
> On Tuesday, February 18, 2014 08:47:34 AM Matthew Frank wrote:
> > But here's my devectorized version of hsi2rgb(). It takes 7.2 seconds!
> So
> > either I did something
> > completely wrong in the devectorization (quite likely), or sometimes
> > devectorization is
> > a bad idea performance-wise.
>
> You almost surely have a type-inference problem. I haven't played with it
> much, but Leah Hanson's TypeCheck.jl may tell you what you need to know.
> The
> profiler (see description in the stdlib documentation) may also help you.
>
You are correct. Declaring the H, S and I arrays as Array{T,2} makes the
runtime of the
devectorized version drop to 0.3 sec (20x speedup over the badly typed
devectorized version and
more than 4x faster than the version currently in algorithms.jl). I don't
understand Julia's type
inferencer well enough yet to explain what was going wrong.
I'll take a look at Color.jl and then see what I can contribute.
Thanks,
-Matt