Hacker News new | past | comments | ask | show | jobs | submit login
Julia: Come for the Syntax, Stay for the Speed (nature.com)
62 points by sohkamyung 7 months ago | hide | past | web | favorite | 23 comments

I love julia, I really do. It has a great syntax and is extremely fast compared to other languages with such a high level syntax.

But the main complaint I see and completely agree is that it feels very slow. You want to import the plotting library? Write 'using Plots' and wait 3 minutes. You want to use a function just once? Too bad, you wait 10 times the amount of time you would wait if you ran that in python (If you run the function again, it is almost instant since it is now compiled).

I get this is what allows Julia to be such an effective language but there still is a lot of room for improvement. But for those of you that are interested in it, give it a try and you will enjoy how powerful the language is. For example you can have hundreds of lines of complex algebra functions and by just adding a line to the top like 'input = gpuarray(input)' and now all your code is 100 times faster because it magically runs on your gpu. Another favorite feature for me is function broadcasting. Simple example 'lowercase(x)' gives lowercase version of string x. You have a matrix of strings that you want to lowercase? Simply write 'lowercase.(s_matrix)' These features and excellent packages that provide parallelization makes an excellent language. I mostly use Julia for computation heavy tasks, if the compilation times were reduced it would be my go to language for all kinds of tasks.

The "time-to-first-plot" (compiler latency) problem is something that the Julia gurus know about and are working on. For example, Jeff Bezanson gave a talk [1] at the just-completed JuliaCon that listed this as the first on a list of known problems with Julia.

One immediate solution is to use PackageCompiler.jl [2] to build a Julia image that includes a pre-compiled version of the slow code (packages).

[1] https://www.youtube.com/watch?v=TPuJsgyu87U&t=11s

[2] https://github.com/JuliaLang/PackageCompiler.jl

When I was managing a deep learning team last year, my boss’s boss asked me if I had looked a Julia. I had not, but promptly spent a weekend playing with it. The deep learning library Flux is very good, GPU setup is really easy, and I wrote up snippets for text processing, web scraping, simple NLP, etc. I was doing a personal evaluation to see if it could be a language that I could do everything in. The answer was ‘yes’ but I ended up sticking with a mashup of Common Lisp and Python for my personal projects.

Julia is a fun language to use because it has a great repl and a pleasant enough syntax.

So, why didn't you keep using it?

I have been using Common Lisp since 1982 - a lot of history!

There is a chance that I might switch over some day. I also like how easy it is to call out to other languages with Julia. Also, the occasional long load times because of the LLVM stuff does not bother me.

My feeling is that Julia is a DSL in scientific computing, like "modern Fortran". It fills a niche. In contrast, Python (still the defacto dominating programming language in many scientific computing areas) is widespread in many domains beyond science. Does anybody confirm that? I mean Julia is a general purpose programming language, but I don't know anybody who uses Julia to write software for the web, desktop or smartphone applications, etc.

I think Julia is still too new to really tell. There are some web frameworks for Julia and I think it does have the potential to be as general purpose as Python, versus something like MATLAB / Octave which is dedicated to scientific computing.

I think it’s more fair to say R and matlab are domain specific language for scientific computing as the core of the languages makes assumptions about your data structures (you can only have vectors and matrices. There are no scalars - only arrays of scalars)

Julia’s community focus on scientific computing, but I’m sure in five years time, nobody is gonna bat an eye when a Julia ship do their infrastructure scripting in Julia (while we’ll still bat an eye at R shops doing that in R)

I decided to work along with the ThinkJulia tutorial until I got to the first case study: Turtles. The ThinkJulia package installed fine, but the tutorial doesn't tell you how to get out of package install mode. After trying 'quit' and 'exit', a Ctrl-D got me out of julia.

Started it up again, proceeded with 'using ThinkJulia' which spit out a warning about updating a manifest file and to try 'Pkg.resolve()' which I did. It gave me an error, 'Pkg not defined'. Spent a few minutes failing to get the turtle, but did somehow wind up back in pkg mode which I still don't know how to get out of. To hell with that tutorial.

Backspace gets out of REPL modes, though I agree that that isn't necessarily obvious for people not used to this kind of modality. I'm sure the ThinkJulia folks would appreciate a note so they can improve the tutorial: https://github.com/BenLauwens/ThinkJulia.jl/issues.

Of the four or so tutorials I took a peek at, only the one on qualitative economics mentioned the backspace as how to get out of pkg mode. I'm left wondering what's wrong with Escape.

The authors don't seem to have touched it since their O'Reilly book was published.

Well, you get into the pkg mode by typing `]`, so from an intuitive standpoint you get out by deleting that character. When you're in any REPL mode there is a character typed at the beginning of your line that renders as a mode. Delete it, and it goes away.

I think it makes more sense than escape, actually, but everyone is so used to using escape that it's not too strange to not think of it.

Intuitive to me: press a button toggles a mode. Hit the button again to toggle again. Also intuitive to me: press a button to toggle a mode, hit Escape to escape that mode. Not intuitive to me: press a button to toggle a mode. Press Backspace to erase a character that isn't on the screen.

But didn't it become more intuitive when I explained it? 'Type something to enter a mode, delete it to exit'. I'm pretty used to invisible characters, but I just think it makes sense. Anyway, you really just need to hear it once, and then it should stick.

No, I still don't find anything intuitive about it. It's not hard to memorize, but I still don't find it an intuitive or sensible method for exiting.

FWIW before using Pkg.<something>, you usually need to do "using Pkg" first, that may have been the issue with the 'Pkg not defined' error.

That does make sense, however it doesn't help the case for it being a particularly good tutorial.

Agree about that. And I'm not wild about the idea of having to do a special incantation before using the package system anyway, myself.

Julia is great. You can call codes from different libraries and they will just work together, even from C/C++/Python libraries. One of the bad things right now ihmo is toolings. Despite having LanguageServer, the IDE-like capacities aren't Java-level mature yet, so it feel a little bit messy for large project. I'm trying to make a PoC to bring lsp features to Intellij platform here https://github.com/JuliaEditorSupport/julia-intellij/pull/41.... I think if someone's willing to improve the toolings and web dev ecosystem, it will be more suitable for general purpose programming.

>Launched in 2012, Julia is an open-source language that combines the interactivity and syntax of ‘scripting’ languages, such as Python, Matlab and R,......

Julia's syntax reads more like Ruby than any of the three named. And yet no mention of it.

It is really similar.

For me it was surprisingly easy to move my math heavy code from Ruby to Julia, and got a 30x speedup.

Clojure: Come for the hair of Rich Hickey, Stay for the insanely productive alien technology

Julia is the second coming of Dylan.

A kind of Lisp with Algol-like syntax.

Lisp is the alien technology, not Clojure.

Applications are open for YC Summer 2020

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact