News for hackers. Stuff that matters.
Re:Why Julia by enriquto on Saturday February 23, 2019 @09:06AM (#19233352)
> it's faster than other scripting languages

That certainly depends on your use case. For instance, the launch time is ridiculously slow, so that you cannot realistically run a small matrix computation in julia from within a shell loop. It is better to use octave for that, where the startup time is almost negligible (just a bit slower than starting a subshell).

Re:Why Julia by rotorblade on Saturday February 23, 2019 @09:34AM (#19233450)
I agree. I meta-programmed (enormous) expressions from analytical expressions exported from Mathematica to Julia, because I found Julia to be ~3000 times faster than Mathematica when it comes to calculating eigenvalues. Using BigFloat for higher precision, my matrix function in Julia took ~20 minutes to compile on the first run and ~20 GB of RAM. Smooth once compiled, but I was the only one of my collaborators that had the capacity to run it.
Re:Why Julia by rotorblade on Saturday February 23, 2019 @08:01PM (#19236430)
Note, that I still do like using Julia. I'm a physicist and need to do a lot of computations in a hassle-free way, then jupyter+Julia (+ SymPy) is(/are) the best available tool(s).

The above may only be an issue of BigFloat, to be fair, since Float64 compiled in an instant (never measured, and the time never bothered me).

So Julia has solved a lot of problems for me, and I see great potential for it in the future.

Re:Why Julia by agumonkey on Saturday February 23, 2019 @09:44AM (#19233485)
I didn't find it slow, but:

    $ time julia -e 'print(1)'
    1
    real    0m0.438s
    user    0m0.300s
    sys     0m0.118s
    $ time python -c 'print(1)'
    1

    real    0m0.040s
    user    0m0.036s
    sys     0m0.003s
it is slower..

That said, instanciating julia every step of a bash loop.. I think it requires a jvm mindset, warmup once and iterate inside rather than outside.

Re:Why Julia by enriquto on Saturday February 23, 2019 @09:53AM (#19233532)
> I think it requires a jvm mindset, warmup once and iterate inside rather than outside.

I do not have this mindset then. I prefer tools who are mindset oblivious. They are really useful!

For example, imagine I have a collection of a few hundred images with their projection matrices (in text files). I want to crop them and apply a simple imagemagick operation (which is not available from inside julia). The elementary solution is to run a shell loop to apply the crop, and call julia to perform a simple adaptation of each projection matrix. This is impossible today: most of the running time of such loop is spent on julia initialization. Half a second to do nothing is simply unacceptable in a serious scripting language.

Re:Why Julia by coldtea on Saturday February 23, 2019 @12:23PM (#19234302)
>I do not have this mindset then. I prefer tools who are mindset oblivious. They are really useful!

Yet you picked a specialized tool "imagemagick" (made for working with images), and want to drive it by another specialized tool (the shell, made for file and process management).

Since you want "mindset oblivious" tools why not write everything from scratch, in C?

Re:Why Julia by enriquto on Saturday February 23, 2019 @12:30PM (#19234341)
> Since you want "mindset oblivious" tools why not write everything from scratch, in C?

Because imagemagick, julia and other specialized programs already provide the advanced algorithms that I need. Unfortunately, julia is not a good team player.

Re:Why Julia by krull10 on Saturday February 23, 2019 @02:14PM (#19234982)
The Julia tooling is not currently designed for repeatedly creating new REPL/interpreter instances to quickly solve one small problem.

What it excels at is rapidly solving the same problem many times within one REPL/interpreter (since after the first time the code will be compiled), or for longer computations where the overhead of the initial compilation does not matter.

It would be great if it could also get fast at the use case you are interested in, but this isn’t currently what it excels at.

Re:Why Julia by coldtea on Saturday February 23, 2019 @06:15PM (#19236022)
>Unfortunately, julia is not a good team player.

Or, you know, Julia is not specialized for your use case.

Re:Why Julia by agumonkey on Saturday February 23, 2019 @10:04AM (#19233588)
I guessed that it wasn't your habits but if you step outside that box a bit you'll realize that lifting up or down things inside loops is the most natural thing to do. And for you example (which may not be your real use or workflow) you could have two loops, independent or coupled through a queue so that the julia process is only started once.
Re:Why Julia by enriquto on Saturday February 23, 2019 @10:09AM (#19233616)
Of course! Once I realize that after a few seconds only a dozen images have been processed I cut the loop, remember that the julia repl is dog slow, and then, rewrite the task in a different way. But I would prefer not to have to do that. Moreover, for more complicated examples, there may be data dependencies that make the loop commutation non trivial.

The slow startup time may be a minor inconvenience, I agree. But nonetheless it seems to be a case of sloppy engineering, as other scripting languages do not have this egregious problem. It sets a bad tone, and makes me wonder if there are other hidden monsters inside the interpreter, that may be solved by "you are holding it wrong" like this one.

Re:Why Julia by agumonkey on Saturday February 23, 2019 @10:18AM (#19233650)
Yeah I get it, it's inconvenient. But I taking the jvm thing again, I think julia's value is outside of this way of doing things.

Out of curiosity I timed ocaml

    $ time echo 'let x = "1" in print_endline(x)' |  ocaml -stdin - 
    1
    
    real    0m0.045s
    user    0m0.039s
    sys     0m0.007s
I thought julia init time was due to type checking phase but ocaml seems to have no issue, even with non zero code:

     $ time echo 'let l = [1;2;3;4] in let m = List.map (fun x -> x*x) l in print_int(List.length(m))' |  ocaml -stdin - 
     4
     real    0m0.050s
     user    0m0.040s
     sys     0m0.011s
Sad, I liked a lot of Julia features..

ps: this hints at the init time being constant recompilation of its core https://www.reddit.com/r/Julia/comments/4c09m1/julia_045_sta... and they were thinking (2 years ago) of caching..

Re:Why Julia by dnautics on Saturday February 23, 2019 @12:31PM (#19234344)
What were you planning to use Julia for where its init time matters?
Re:Why Julia by agumonkey on Saturday February 23, 2019 @01:21PM (#19234669)
Nothing, i'm just curious [1] about Julia. I never used it.

[1]It's just because i find the science python stack a bit absurd.

Re:Why Julia by krull10 on Saturday February 23, 2019 @02:06PM (#19234942)
Right now, using is as a “quick” command line utility for solving small problems is probably not a good Julia work flow (unless the overhead you mention doesn’t matter to your application). Where it shines is for longer-running or repeated computations where the initial compilation cost of starting a new REPL doesn’t matter.
Re:Why Julia by agumonkey on Saturday February 23, 2019 @03:04PM (#19235191)
Preaching the convinced
Re:Why Julia by xiphias2 on Saturday February 23, 2019 @02:01PM (#19234911)
You have to use it inside a REPL, like R or Matlab. Julia using LLVM and compiling on-the-fly is not sloppy design, it's a design tradeoff (and a great one, if you really need speed).

Julia is not a scripting language, it's a language for mathematical analysis.

Also going back to your example the solution would be to use ImageMagick.jl from Julia, and extend the library (4 extra lines with ccall) if it's not available, and send a pull request to help the community.

Re:Why Julia by enriquto on Saturday February 23, 2019 @02:43PM (#19235104)
> Julia is not a scripting language, it's a language for mathematical analysis.

Ok, this clarifies the matter a lot. So julia is not intended to be a general-purpose programming language. Are you involved in julia development?

(Besides, I strongly dislike the design tradeoff of not being a good unix citizen.)

Re:Why Julia by ddragon on Saturday February 23, 2019 @03:37PM (#19235329)
Julia is a general-purpose programming language. The language itself is actually really good as a scripting language, including integrating well with shell, C, Fortran, R and Python, for example:

https://docs.julialang.org/en/latest/manual/running-external...

The only trade-off here is the restricted resources the Julia devs can afford. Focusing on the scientific computation niche, the Julia compiler was built to compile code just ahead of time, since this way it can create code as fast as compiled languages while still being dynamic like any interpreted language (such as Matlab and Python). But there is nothing in the language that prevents it from being fully interpreted (and therefore having minimal compile time overhead, but generating poorly optimized code for long running processes), or alternatively pre-compiling and caching to have both (which is being worked on: https://github.com/JuliaLang/PackageCompiler.jl )

Re:Why Julia by agumonkey on Saturday February 23, 2019 @03:03PM (#19235185)
Not Scripting != Not general purpose
Re:Why Julia by xiphias2 on Saturday February 23, 2019 @04:32PM (#19235598)
I'm not a Julia developer, but the great thing with Julia is that the libraries are exceptionally easy to read and extend, because the core developers make a strong effort to write clean code. Just look at ImageMagick.jl and you'll see, but I have the same experience with other libraries as well.

Also the language itself supports extending code (multiple dispatch really helps it to stay clean).

Re:Why Julia by pkofod on Monday February 25, 2019 @04:52AM (#19244399)
Why can you not call you imagemagick operation from julia? Can't you just `run(``)` it?
Re:Why Julia by enriquto on Monday February 25, 2019 @10:12AM (#19246142)
This is a part of a quite large system that does a lot of things. I do not want to wrap everything inside julia, that would force me to rewrite everything in julia. I just need to invert a few 4x4 linear systems from inside a shell script. I agree that this is not a very representative use case, and maybe it is irrelevant for most people. Yet, if I try to evangelize julia in my lab this problem blocks it, and it is better to stick to octave.
Re:Why Julia by throwawaymath on Saturday February 23, 2019 @05:30PM (#19235857)
To demonstrate how slow the startup time is, here’s the respective times for executing ‘print(1)’ from Bash and from REPL on my machine:

REPL:

    julia> @time print(1)
    1  0.000031 seconds (7 allocations: 272 bytes)
Bash:

    $ time ./julia -e 'print(1)'
    1
    real    0m0.184s
    user    0m0.156s
    sys     0m0.168s
So yes, that’s a slow launch time. If you use Julia in a shell script and it’s starting up Julia on each calculation it will be brutally slow. Five orders of magnitude slower, in this case.
Re:Why Julia by agumonkey on Saturday February 23, 2019 @06:09PM (#19236004)
honestly, parent had a use case in mind but it's ultra orthogonal with julia's goals. They're aiming at large numerical problems.. as I said above, if you need julia to make a quick one shot computation in a bash script loop, by all means use something else. But my bet is that anybody reading about julia is planning to do the heavy work inside of it, in which init time will probably be insignificant.

It's a bit annoying it's true, a well featured language with dynamic/repl appeal that is not in the ms launch time. But alas..

Re:Why Julia by throwawaymath on Sunday February 24, 2019 @01:46AM (#19237467)
Totally agreed, I'm a fan of Julia. I just wanted to comment with the delta between startup time and actual execution for passerby.
Re:Why Julia by IshKebab on Saturday February 23, 2019 @01:06PM (#19234580)
First of all that is ridiculously slow. Secondly, unlike Matlab you don't have everything you need available after starting the REPL. For instance if you want to plot something you might run `using Gadfly`. How long does that take?

16 seconds. Sixteen seconds. For real. This is not usable.

Re:Why Julia by agumonkey on Saturday February 23, 2019 @01:25PM (#19234709)
Hold on how long is MATLAB boot ?
Re:Why Julia by enriquto on Saturday February 23, 2019 @01:31PM (#19234741)
maybe he was thiking about Octave, that is an interpreter for the same language as Matlab and it starts much faster.
Re:Why Julia by dnautics on Sunday February 24, 2019 @11:37AM (#19239221)
Yeah but heaven help you if you need nested for loops in octave.
Re:Why Julia by IshKebab on Sunday February 24, 2019 @12:54PM (#19239631)
Much less than 16 seconds. And that gives you a whole IDE.
Re:Why Julia by marmaduke on Saturday February 23, 2019 @01:16PM (#19234632)
Agreed Octave works excellently as a linear algebra/numerical subshell for Shell scripting, better than Python IMO.