I suspect you may have a type-stability issue in your algorithm, limiting
Julia's ability to optimize. Typically, you want to initialize variables
with `zero(eltype(A))` or similar such statements. See
http://docs.julialang.org/en/latest/manual/performance-tips/ and
https://github.com/astrieanna/TypeCheck.jl

On Sat Nov 08 2014 at 2:52:13 PM Jason Merrill <[email protected]> wrote:

> Here's a sketch of a different algorithm that I believe converges to the
> same value:
>
> 1. Initialize thresh to the mean value of the image pixels
> 2. Compute the mean of the pixels that are larger than thresh, mplus, and
> smaller than thresh, mminus.
> 3. Set thresh to the mean of mminus and mplus, and then loop back to 1.
> Iterate to a fixed point.
>
> You can implement this version without allocating any extra data
> structures, so it may well be much faster.
>
> Sorry I don't have any references here. Writing from a phone.
>

Reply via email to