On 24 September 2015 at 14:47, Christof Stocker <stocker.chris...@gmail.com> wrote:
> As far as I can tell (from first hand experience), Julia really does give > you a prominent edge over R and Matlab in terms of performance. However, I > also think that there are currently a lot of ways to shoot yourself in the > foot (accidental type instability and memory allocation are the most > prominent of those in my experience). > To me Julia feels like a lower-level language than Matlab or Python. Julia code is compiled very directly into machine code, and that makes it feel a step closer to Fortran or C. For example, in Python or Octave, if your integer gets too big, you are auto-converted to BigInt: octave:1> 2^62 ans = 4.6117e+18 octave:2> 2^63 ans = 9.2234e+18 octave:3> 2^64 ans = 1.8447e+19 $ python ... >>> 2**62 4611686018427387904 >>> 2**63 9223372036854775808L >>> 2**64 18446744073709551616L In Julia, you just get an overflow, just as you would in C++ or Fortran: julia> 2^62 4611686018427387904 julia> 2^63 -9223372036854775808 julia> 2^64 0 I personally like this a lot. With Julia I feel like I have control over that the program does, without the hassle of static types, variable declarations, or memory allocation. I feel that Julia is a good balance between the convenience of Matlab/Python and the performance and control of C++/Fortran. > So currently I don't think that Julia allows you to naively write "simple > and efficient code", iff you are not used to the language. > Can you name any language that allows you to write efficient code if you are not used to the language? I teach Matlab. My students always write horribly slow and inefficient code because they instinctively code Matlab like it is Java. I have to drill into them the notion of vectorized code. Given that we are not at version 1.0 yet, I don't mind that at all. I see > it like this: If you know what to look out for, the code is usually pretty > competitive with C (about a factor of 2 to 3 currently for my code). I > rather have the developers focus on improving the potential performance, > than on making it "idiot proof" just yet. I think the later is best tackled > after the more pressing issues are taken care of. > Making the language idiot-proof will make it slow (see my example above). > That being said, I do think one should be careful of how Julia is > advertised by word of mouth. The comparison to Matlab, which has a very > similar syntax but (I think) a very different way of efficient coding, can > be a red herring and give rise to false expectations. I don't think you can > currently just copy and paste Matlab code and expect it to be faster. > Yeah. The fact that the syntax is similar can lead people to think that you are supposed to write Julia the way you write Matlab. Cheers, Daniel.