Re: [julia-users] Simple speed test

2014-03-22 Thread John Myles White
To follow up on this point — for small loops, the compiler will completely remove the loop: function f() res = 0 for i in 1:10 res += i end return res end code_llvm(f, ()) -> define i64 @julia_f15221() { pass2: ret i64 55, !dbg !375 } — John

Re: [julia-users] Simple speed test

2014-03-22 Thread Chris Foster
A word of caution - these kind of "benchmarks" aren't very meaningful since the compiler is free to optimize everything away if you don't do any useful work: julia> code_native(g, ()) .text Filename: none Source line: 4 pushRBP mov RBP, RSP mov EAX, 1000

Re: [julia-users] Simple speed test

2014-03-22 Thread Jason Merrill
The machine code generated by g is kind of amusing. I'm going to define g3 slightly differently to avoid some confusion: julia> function g3() x = 0 for n = 1:1 x += 3 end return x end g3 (generic function with 1 method) julia> code_native(g3, ())

Re: [julia-users] Simple speed test

2014-03-22 Thread cnbiz850
On Ubuntu Trusty 64bits with i7 laptop, my result as follows. Notice the difference from Jason's julia> @elapsed begin x = 0 for n = 1:1 x += 1 end x end 4.576735929 julia> function g()

Re: [julia-users] Simple speed test

2014-03-22 Thread Jason Merrill
This is not a small nit that John is picking: julia> @elapsed begin x = 0 for n = 1:1 x += 1 end x end 7.333491931 julia> function g() x = 0 for n = 1:1 x += 1 end return x end g (generic

Re: [julia-users] Re: The "then" keyword

2014-03-22 Thread Ethan Anderes
I'm probably being stupid here but why not just: i==1 ? do_stuff() It seems natural to me given the syntax A ? B : C Cheers, Ethan

Re: [julia-users] Re: The "then" keyword

2014-03-22 Thread Andrew Burrows
I like the idea of providing a nice syntax for one if statements but agree with Job van der Zwan about one-liners that grow. That comment immediately made me think of Apple's gotofailbug. Maybe the i

Re: [julia-users] Simple speed test

2014-03-22 Thread Ivar Nesje
PyPy is faster for this because Python is a highly dynamic language. In order to get any performance from JIT compilation, it have to analyze the runtime values, and guess that the variables inside the loop does not change types. If the variables change type, an assertion triggers, and PyPy will

Re: [julia-users] Simple speed test

2014-03-22 Thread Jacob Quinn
Yes, please see the big, bold first heading of the Performance Tips section of the manual: http://docs.julialang.org/en/latest/manual/performance-tips/ -Jacob On Sat, Mar 22, 2014 at 5:18 PM, John Myles White wrote: > Is this in the global scope? > > -- John > > On Mar 22, 2014, at 2:16 PM, Bo

Re: [julia-users] Simple speed test

2014-03-22 Thread John Myles White
Is this in the global scope? — John On Mar 22, 2014, at 2:16 PM, Bob Cowdery wrote: > I know this is hardly a scientific test but I'm curious why Julia is 5 times > slower than PyPy on an almost empty loop. > > julia> x=0 > julia> for n = 1:1 >x += 1 >end > > Time 5s

[julia-users] Simple speed test

2014-03-22 Thread Bob Cowdery
I know this is hardly a scientific test but I'm curious why Julia is 5 times slower than PyPy on an almost empty loop. julia> x=0 julia> for n = 1:1 x += 1 end Time 5s PyPy takes 1s and Python takes 19s for the equivalent loop. All executed from the command line. Bob

[julia-users] Re: pycall error

2014-03-22 Thread Steven G. Johnson
Sounds like maybe the hash digest is claiming to be a string, but isn't actually valid UTF8 data? Maybe just leave it as an opaque PyObject: secret = pycall(hash["digest"], PyObject) (By using the pycall function, you can specify the desired output type of a function.)

Re: [julia-users] Re: The "then" keyword

2014-03-22 Thread Job van der Zwan
On Friday, 21 March 2014 21:54:53 UTC+1, Stefan Karpinski wrote: > > On the other hand, saying "4 == 2 + 2 or go home" is perfectly reasonable > ;-) > I like the && and || trick - hadn't seen it before and it's quite neat that it just happens to work due to the language design! *But* the || was

Re: [julia-users] Re: Scientific papers using Julia

2014-03-22 Thread Waldir Pimenta
The Wikimedia Research Newsletter[1] has been using icons for open access[2] / closed access[3] next to each publication. That's an interesting approach that could be adopted in the Julia publications page for easy visual identification of the freely accessible publications, without splitting t

Re: [julia-users] Re: The "then" keyword

2014-03-22 Thread Matt Bauman
Yes, exactly, I was imagining it as a sugar for `4 == 2+2 ? go_home() : nothing`. I'm liking this more the more I think about it. Amazingly, Julia passes all tests after adding `then` to the reserved words list in julia-syntax.scm. Of course, it should probably be deprecated as an identifier

Re: [julia-users] Re: Scientific papers using Julia

2014-03-22 Thread Andrea Pagnani
I do not see the rationale behind splitting papers using Julia into free and not free journals. In any case I really think that having a fair representation on what is scientific usage of Julia, could be beneficial both to developers and a source of inspiration for potential users. A On Frida

[julia-users] Re: Build Failure "undefined symbol: rl_signal_event_hook"

2014-03-22 Thread Michael Hatherly
Update on the problem: If you add *USE_SYSTEM_READLINE=1* to your *Make.user* file and then run *make cleanall* it should resolve this issue. This is mentioned in the README.