On Friday, 22 August 2014 00:08:20 UTC+2, Bill Hart wrote:
>
>
>
> My cursory look into Julia only poped out JIT stuff, not a real 
>> complier... 
>>
>
> Static compilation is coming to Julia. But not because it will speed 
> things up. It already has all the speed of an optimising compiler at the 
> console, as you type!
>

I should qualify that. Technically, jit compilation and type inference 
begin at the function boundary in Julia. So stuff you type at the top level 
is not optimised. I think that is a mistake, as it's unnecessary. In the 
language I was working on (using LLVM) type inference and optimisation 
begin at the top level (which for me is a function). There is a small 
runtime hit with global variables, but that is all.

In particular, in the language I was working on, loops at the top level are 
jit compiled. In Julia they are not. But it's almost irrelevant, except 
when doing timing experiments to see how fast Julia really goes. You might 
easily think to type a loop into the top level and time it and wonder what 
all the fuss is about. Put that loop inside a function and you'll soon see.

julia> function sumit(n::Int)
          s = 0
          for i = 1:n
            s += i
          end
          return s
       end
sumit (generic function with 1 method)

julia> @time sumit(1000000000)
elapsed time: 0.913325036 seconds (78060 bytes allocated)
500000000500000000

Bill.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to