Hi Hans,

There was a huge slowdown in your code with : local i::Int. If you change 
it to i = 0 (therefore i::Int64), the return type is always Int64. 
Therefore, Julia can generate efficient code.

Use @time to check it. This change makes your code 10 time faster on my 
machine.


On Wednesday, May 21, 2014 8:41:54 AM UTC+2, Hans W Borchers wrote:
>
> Sorry, but this was only an example of using a loop variable outside the 
> loop.
> The real code was not that trivial -- was that not clear from the 
> question: "Imagine the following function ..."?
> Then I apologize for poor wording.
> Wanting to know when at what point a loop breaks is a natural request in 
> many numerical algorithms.
>
>

Reply via email to