17 ms·
Why Julia
- tnecniv 8y agoHonestly my biggest bug with Julia was the lack of good programming environment. I detest MATLAB, but I can be very productive in that IDE. PyCharm is pretty good too when using NumPy. For Julia though, the tooling just didn't seem there yet.
- tbenst 8y agoJuno is actually quite nice. I find it far more productive than Jupyter and superior to Hydrogen
- ashton314 8y agoI didn't know about the Unicode tab completion. I gave it a whirl on the cli and loved it. Then I tried it out in julia-mode in Emacs, and it works there too! What other editors support this?
- improbable22 8y agoCertainly Atom (and Juno), Sublime Text, and Jupyter notebooks.
- jarvist 8y agovim: https://github.com/JuliaEditorSupport/julia-vim https://github.com/JuliaEditorSupport/julia-vim I have an F-key shortcut in my .vimrc to turn this on mainly for non-Julia files, so that I can type (maths-y) unicode in Markdown / text files.
- krull10 8y agoWorks in VSCode with the Julia extension too.
- siproprio 8y agoWhenever I see people claiming that Julia is fast, I feel like they are cheating. It is only fast if you don't count the "compilation" times. For example, every time you are trying to plot something ```using Plots```, it will take over 40 seconds to compile the Plots package. Then, you have the large memory usage. In my experience, plotting in Julia requires approximately 14x more RAM than in python or Matlab. Julia has an awful experience, really.
- sgillen 8y agoThat's the trade off I guess, because of the JIT you have a slow initialization followed by very fast code. That's not really good for a lot of workflows though (if you're running a smallish script over and over for example).
- deleted 8y ago[deleted]
- babahoyo 8y agoIf you are running a script over and over (or using small modules to do organize things) it will be very fast and easy to work with. The compilation is just for the first time a script is run, not every time. It really isn't a barrier any more than, say, waiting for `library` commands in R.
- bluenose69 8y agoI don't think I've ever seen an R library() take more than about a second, and usually the action is complete as my finger is starting to raise from the 'return' key. When I tried "using Plots" in julia, it took several tens of seconds the first time, and several seconds in subsequent sessions. So, slower than R, but not terribly so. I suspect the real advantage of Julia is that it lets the analyst stick to a single language, without (as in the R case) having to write time-consuming components in C, C++, or Fortran.
- 8y ago
- deleted 8y ago[deleted]
- antpls 8y agoWhy not Julia : https://juliacomputing.com/about-us.html https://juliacomputing.com/about-us.html 27 men and 1 woman, which is a bad parity score, even for a tech company.
- paper-boat 8y agoThat is a terrible argument on the usability of a tool.
- rocksportrocker 8y agoJulia looks for me more like an academic exercise to show you you can come up with a "scripting like" language which is also fast. It looks julia developers implemented nice looking features, which can cause problems: pi = 3 print(pi) works, but print(pi) pi = 3 not (second version makes magic import which imports a constant). Same for omitting multiplication "*": 3(x + 1) is ok, but x(x + 1) not (because julia assumes a function call here). These adds lots of problems for larger programs and maintainability.
- enriquto 8y ago> 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).
- rotorblade 8y agoI 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.
- rotorblade 8y agoNote, 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.
- agumonkey 8y agoI 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.
- throwawaymath 8y agoTo 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.
- altairiumblue 8y agoAs someone who has never run into performance problems with R, and also knows how to use Python - is there a good reason to learn Julia?
- simonbyrne 8y agoObviously that question depends on your motivation, but one good reason is that it is a great way to learn how software actually works. R makes it very easy to see the underlying R code (you just type the function name), until you get to a ".Call" or ".Primitive": from that point, it is effectively a black box. But as most of Julia is written in Julia, you can easily inspect and understand how functions work, all the way down. Moreover, by using the @code_* macros, you can also inspect the various stages by which the code is transformed from high level Julia code down to the actual machine code which is running on your computer.
- shele 8y agoThink about it a moment, which answer would you prefer?
- altairiumblue 8y agoRegardless of the answer, I have plans to learn it simply out of curiosity. I'm just not yet convinced that there are any practical benefits to using Julia over the other languages.
- ethelward 8y agoAs you said yourself, you have no performances problem with R and Python, so I do not think you need to learn Julia. However, in fields dealing with larger datasets (e.g. genetics, astrophysics, ...), Python and R are real bottlenecks in data processing pipelines, and are thus often replaced by programs in C/C++/Java/etc. Having a language with the expressiveness and dynamism of Julia on the one hand, and performances in the same order of magnitude than C++ in the other hand is a huge plus.
- Datenstrom 8y agoI recently began learning Julia and initially everything was amazing, except for 1 based indexing but with everything else I could overlook that. Then I attempted building something medium sized and it all fell apart. I feel like it needs some serious work on tooling, the module system, packages, etc. Has anyone built something medium-large sized in Julia? Maybe I'm missing something. When I was trying to use modules to organize my code the response I got was that modules are more trouble than they are worth so just don't use them. So why do they even exist? That really put me off from Julia despite really liking it otherwise. I would want to build things with it not just play in a REPL and notebooks.
- walshemj 8y agoout of interest what would you consider medium sized?
- agumonkey 8y agoout of curiosity, could you give more details about modules problems ?
- Datenstrom 8y agoI do not recall the exact issue anymore unfortunately, I abandoned the project because of it, but the general sentiment on the Julia discourse seemed to be just avoid them. This blog post seems to sum up my issues with modules and namespaces pretty well though: http://luthaf.fr/julia-some-criticism.html http://luthaf.fr/julia-some-criticism.html I think that these issues are generally acknowledged although I don't know if they will be addressed. Seems like major pain points for library development should have been addressed before 1.0.
- ChrisRackauckas 8y agoA lot of this blog post is addressed by just using `import` instead of `using`... so it was actually just an issue of not reading the manual. It's like using `from package import *` and then complaining Python doesn't namespace properly.
- alanfranzoni 8y agoSo... The answer is fundamentally "statically typed", right?
- pron 8y agoJulia is not statically typed, at least not in the common sense of the term.
- alanfranzoni 8y agoYes, I got that. But the "good parts" according to this artcle derive from where it can work like a statically typed language.
- dnautics 8y agoYeah but it's not statically typed. Let's say you have a machine learning algorithm and you'd like to change your algorithm to have a complex-valued weights instead of float valued weights. How do you do that in a statically typed language? Let's say you want to test the numerical performance of the fast Fourier transform using an alternative datatype to IEEE 754 (for example bfloat8). How do you do that? Another application:. I wanted to play with galois fields for reed Solomon encoding. One key step is LU decomposition to recover missing data. Well, as it turns out built-in matrix solving algorithm in Julia is general, (though it does kick over to BLAS for floats), so my galois field type was plug and play, I didn't have to write a custom solver.
- alanfranz 8y ago> How do you do that in a statically typed language? You can do that only if the interface for both types is identical or compatible. They should offer at least a common subset of the same operations. Hence, "generics" is the answer to your question. I understand your feeling. But my impression is that this kind of "black magic" isn't always the best. With generics and static typing, if it compiles, you'll know it will work. With "type inference" you need to test it at runtime. It may compile with near-native performance, or it may not. And maybe a small change in your source code will turn near-native performance to dismal performance.
- FabHK 8y agoI like Julia a lot, and thought I understood some of it, but this article puzzles me: > This output is saying that a floating point multiplication operation is performed and the answer is returned. But "this output" is: %2 = mul i64 %1, %0 ret i64 %2 which looks very much like an int64 operation and return. Similarly: > Here we get an error. In order to guarantee to the compiler that ^ will give an Int64 back, it has to throw an error. If you do this in MATLAB, Python, or R, it will not throw an error. while the quoted input and output is In [6]: 2^-5 Out[6]: 0.03125 (ie, no error, but the correct (floating point) result.)
- ChrisRackauckas 8y agoThis was written back in Julia v0.5, and the compiler got smarter so I need to update my examples :). Here, Julia specializes now on the fact that `-5` is a literal, and then inlines the literal and corrects the output type using that value. If you define it as a variable and stop constant propogation, it'll error. Stuff like this are making it harder to write tutorials to show what's actually going on, because literals and constants are all getting optimized on now! Another confounding fact is that Julia optimizes on small unions, so the generated code isn't that bad anymore. Now it just creates a branch. It used to have to do all of inference and dynamic dispatching on the fly, which is what it has to do in fully uninferrable code of course, but a union of two things just does a type check and splits. So now... that example is not as bad as it used to be...
- FabHK 8y agoAh, well, I guess that's good news then!
- krull10 8y agoAs a rule of thumb, it is probably a good idea to ignore Julia articles that are more than a year or so old. Anything that is discussing pre-1.0 may be completely irrelevant at this point. The language has evolved a lot, even the past few years, and it is only with the 1.0 release last fall that the devs promised to start maintaining backwards compatibility. So there are lots of older articles discussing drawbacks to Julia, or ways to do things in Julia, that simply aren’t relevant anymore. Unfortunately they still often are the first links that come up when searching google for Julia questions.
- ritoune 8y agoThe main issue I encountered as a Julia user is that multiple dispatch doesn't scale very well. When you start building out a project, it's easy to keep track and debug if multiple dispatch starts failing (i.e. <any> type starts spreading everywhere and Julia slows to Python like speeds). In medium-to-large projects, it becomes extremely cumbersome to manage this. It's doable, but adds a layer of complexity management to projects that simply doesn't exist in strictly typed or pure scripting languages. Of course, you can just decide to explicitly type everything - but the issue here again is the lack of enforcement. In a nutshell: Julia is great when you're a grad student working mostly by yourself on small scale projects! But not so great in prod. And there's really no problem with that; that's who the language was designed for!
- nicoburns 8y agoThe optional typing seems like the perfect solution to this... skip explicit typing for small scale projects, but make sure you add it for production...
- m4x 8y agoI think multiple dispatch will scale perfectly fine for large projects when it has better IDE support. There's no reason Juno or any other IDE couldn't display the output of a static analyser inline, or allow you to command-click a function call to go to the site of the exact function being called, or show a list of alternatives, and so on. Give Julia and its IDEs a few years to improve and you might find it much better suited to large projects. I wouldn't consider Java any good for large projects either, if it didn't have the excellent IDE support it now enjoys.
- byt143 8y agoBoth cassette based performance linting and static type checking will solve this problem. There are already the beginnings of the tooling being formed.
- ethelward 8y ago> In a nutshell: Julia is great when you're a grad student working mostly by yourself on small scale projects! But not so great in prod. Some people would disagree with that https://juliacomputing.com/case-studies/celeste.html https://juliacomputing.com/case-studies/celeste.html
- objektif 8y agoI tried to like Julia but after a while I realized there was absolutely no use case for me to choose Julia over other languages. It might be useful for new grads looking to learn a language though.
- forkandwait 8y agoI did a 5000 line dissertation project in Octave after rejecting Julia. Reason : I had derived the math in linear algebra including Kronecker products; the math mapped to Octave pretty directly, but Julia requred me to translate all the Kronecker products to loops —yuck! kron(A, B) would become 12 lines of weird indices and for loops. On the listserv I was told that Julia was great because it didn't require vectorization for performance, but I only wanted vectorization for graceful expression. Plus I got annoyed with extra weird syntax, but I can't remember the specifics. Basically, Julia required more lines and characters and wasn't as close to the math. Aside:I think Matlab / Octave is a lot like SQL and Tcl: lots of haters, unfashionable, but usually the most elegant solution .
- thebooktocome 8y agoJulia has had a kron function in Base since at least 0.5.
- ummonk 8y agoI haven't dipped into Julia's macro side, but I wonder how much work it would be to just create macros to create syntactic sugar that maps infix Kronecker products to the Kronecker function. There are so many Julia packages that do similar stuff that I imagine it can't be all that hard for people who have become fluent with the macro system.
- ChrisRackauckas 8y agoWhy metaprogram? Just define an operator using the built in kron function. Example: const ⊗ = kron A = rand(5,5) B = rand(3,3) A ⊗ B Tada! I'm not sure how MATLAB/Octave's kron(A,B) looks more like math than A⊗B, but everyone can have their own opinion.
- ummonk 8y agoOh. For the benefit of others reading this comment thread, this is why that works: https://docs.julialang.org/en/v1/manual/variables/#Allowed-Variable-Names-1 https://docs.julialang.org/en/v1/manual/variables/#Allowed-V... This is the second time I've learned about time-saving functionality related to infix that I didn't know about. (The previous was the symbol for integer division, which had been left out of the documentation until version 0.7). In this second case, interpretation of Unicode symbols as infix operators should be better surfaced in Julia documentation and tutorials - it's a really useful feature.
- xiphias2 8y agoI'm moving my code that uses statistics from Ruby to Julia, and I love the similarities. Of course 1 based indexing makes the move harder, but it's worth the effort anyways. I'm trying to embrace 1 line functions as much as I can, and Julia helps me with it's special notion for short function definition.
- roknovosel 8y agoI just hope they remove the awful @threads macro with https://github.com/JuliaLang/julia/pull/22631 https://github.com/JuliaLang/julia/pull/22631 Developing anything multithreaded was a major pain.
- sidcool 8y agoI tried an earlier version of Julia (0.7). Then there was an update and all packages started breaking. There was no backwards compatibility. We had to rewrite a lot of code and completely change DB layer. I hope it's more stable now
- improbable22 8y agoThere was a big transition to 1.0 last year, for which 0.7 was a transitional release (1.0 but with deprecation warnings for old syntax). The package ecosystem took a few months to catch up, which may have been a confusing time to start. The promise now is that things should be more stable.
- ninesigns 8y agoI wish Julia would be more strict wrt type coercion of integer to float values. I've once spent a day debugging the issue caused by the following line of code, where t1, t2 are floats and v is an array: d = (t2 - t1) * length(v) It should've been LinearAlgebra.norm():Float instead of length():Int. Had julia been stricter the code would have failed to run, saving me much time.
- tkoolen 8y agoI actually can't think of a single language that doesn't allow you to multiply an integer and a floating point value, yielding a floating point result.
- ryl00 8y agoAda?
- the_duke 8y agoRust. In Rust, all type coercion must be explicit, you can't even add different integer types: 5i64 + 5i32 // WONT compile 5i64 + 5i32 as i64 // will work
- gmfawcett 8y agoOCaml has distinct multiplication operators for ints and floats. Haskell's multiplication operator requires its arguments to be of the same numeric type, and returns a product of the same type. That's two, off the top of my head...
- jjtheblunt 8y agoGo ?
- threatofrain 8y agoJavaScript? 23n + 5 causes a TypeError.
- marmaduke 8y agoI want to like Julia but after a decade of Python, every time I try it, it’s a death by a thousand cuts (and outdated Google results). I just can’t afford to have productivity drop to near zero for the learning curve plus reimplement everything. Also I ha e found multiple dispatch to be harder than regular OO methods to locate (for IDEs but grep also).
- kmundnic 8y agoHave you tried methods(some_function) or the @which macro?
- banku_brougham 8y agoYes - doing @edit(arg1,arg2,....) opens the file at the relevent method definition (ie version the same type arguments as given) in my editor. In the julia source code or my own modules.
- krull10 8y agoWhen I search Julia questions on Google I always restrict the search to the past year or six months. You are right that there is an enormous amount of irrelevant info out there from earlier versions of the language.
- rovr138 8y agoYou don’t have to reimplement all your python work from the get go. You can call python from Julia.