News for hackers. Stuff that matters.
Re:Data Science in Julia for Hackers by kasperset on Friday March 19, 2021 @07:37PM (#26519251)
I really want to love Julia language but the overhead of package loading annoys me. Perhaps this may be just me being lazy or spoiled after using R packages or Python libraries.
Re:Data Science in Julia for Hackers by lasagnaphil on Saturday March 20, 2021 @02:33AM (#26521240)
Yeah, it's still dissapointing how much system resources it takes to get a plot running (even with all the improvements in 1.6, benchmark taken from https://www.oxinabox.net/2021/02/13/Julia-1.6-what-has-chang...).

    julia> @time (using Plots; display(plot(1:0.1:10, sin.(1:0.1:10))))
      9.694037 seconds (18.29 M allocations: 1.164 GiB, 4.17% gc time, 0.40% compilation time)
To be honest, this isn't really something the devs should be proud about. 10 seconds, 18.29 M allocations and 1.164 GiB of memory just to render a simple static image is just unacceptable. In order for Julia to be a good-enough language for general scientific usage the current slow LLVM-based JIT compiler sadly isn't enough. I really want Julia to succeed, but this one problem is triumphing over every good language feature.

In an ideal world Julia would have two backends:

- A fast, hand-made JIT backend (something like LuaJIT) which is mostly interpreted and only JIT-compiled in frequently run code paths.

- The current slow, almost-AOT-like LLVM backend which is only used for precompilation of packages

It's just like Debug/Release bulids in C++, except that the Debug builds are lightning fast to compile (but slower at runtime) and Release builds are slower to compile (but hyper-optimized for runtime speed). I guess there's going to be an immense engineering effort if something like this happens, given that Julia today is immensely coupled with the LLVM compiler/runtime. But that's just my pipe dream.

Re:Data Science in Julia for Hackers by jakobnissen on Saturday March 20, 2021 @06:37AM (#26522078)
Agreed, that would be ideal. But it's also a little unrealistic in the short term - most languages don't have an interpreted and a compiled mode. I think there just isn't the dev manpower.

It's more useful to think of Julia's latency as a fundamental constraint of the compilation model. People don't complain that Python can't deliver static binaries, or that C++ is unsuitable for scripting. Julia's compiler can do both (although the "static binaries" haven't materialized, because noone seriously works on it), but the tradeoff is that you suffer from latency. That's fundamental. Future versions of Julia may cut the compilation time down further, but it will never be instant or even close to instant.

So, like other languages, it means you have to look at the strengths and weaknesses of the language for your use case. For myself, I can't imagine a situation where I want to plot something right now and not in 15 seconds. Whenever I plot something, it's always after minutes or (usually) hours of data analysis. Most of my Julia use is either long, interactive sessions where ten seconds of startup doesn't matter much, or long-running pipelines where it doesn't, either.

Re:Data Science in Julia for Hackers by cbkeller on Saturday March 20, 2021 @10:06AM (#26523325)
Little-known fact: there is a Julia interpreter, if anyone really wants to go that way: https://github.com/JuliaDebug/JuliaInterpreter.jl
Re:Data Science in Julia for Hackers by jjoonathan on Wednesday March 24, 2021 @11:41AM (#26568649)
> I can't imagine a situation

If you have N scripts that produce N plots for a paper, you can't just drop them in a makefile or you will pay the 15 second penalty over and over and over every time you build. You can't reset the interactive session as a matter of habit to aggressively control state build-up. Even iterating on a dashboard becomes painful with a long startup time. You have to treat your Julia session like a child, not like cattle. That's limiting and not everyone wants to it, especially now that they are used to treating python sessions like cattle and reaping the benefits.

Re:Data Science in Julia for Hackers by newswasboring on Saturday March 20, 2021 @02:51AM (#26521315)
Here we go again. Those allocations and run time can be avoided entirely using sysimages. Latest vscode extension gives a convenient build task for this.

It seems like every time julia is mentioned, someone has to clarify this.

Re:Data Science in Julia for Hackers by lasagnaphil on Saturday March 20, 2021 @04:32AM (#26521660)
The problem I seem with sysimages, is that the whole process is incredibly unergonomic for exploratory coding, which Julia always claims it is a primary use-case for. When you want to just glue some packages and quickly test out some results, the last thing you want to do is to think about what kinds of functions from libraries you are going to use beforehand, carefully write it in a precompilation file, and wait for the compiler to precompile and cache those code paths! And once those dependencies change even a bit you need to wait for precompilation again, which happens a lot when you're prototyping things fast or upgrading versions (for example, this X numerical computation library doesn't have a particular feature I want to use, so I want to switch to another library Y, but then you need to wait for everything to be precompiled again) The reality is that most people just want to fire up a virtualenv and do the occasional "pip install <my libraries>" and don't want to get involved in any of this stuff. (As someone who uses C++ I have a lot more patience than other people, but you shouldn't really expect much from others)

I think Julia needs to throw away some of the unnecessary obsession for just-ahead-of-time (JAOT) compilation. Compiling everything beforehand to LLVM machine code seems good for raw runtime speed, but it doesn't matter when it takes so much setup time to even just glue some simple libraries. Julia should seriously consider running most of the less-computationally intensive codepaths in a custom-made interpreter without LLVM, while precompiling the numerically intensive parts of library code in raw machine code with the current LLVM backend. Maybe there should be a flag you can use to mark certain functions to be unconditionally compiled AOT-style, and leave the rest to the interpreter. Interpreters can be made surprisingly fast with some effort - stuff like the interpreter in LuaJIT (https://luajit.org/) and HashLink (https://hashlink.haxe.org/) is what comes into my mind.

Re:Data Science in Julia for Hackers by newswasboring on Saturday March 20, 2021 @07:25AM (#26522331)
Regarding your first paragraph, I must ask, have you done significant coding in Julia? Because an outdated sysimage is not really that big of a problem in practice. I have a sysimage which includes common big packages for plotting, numerical computing and some prettifying stuff I like like OhMyREPL. Then during dev time I add and remove packages, the compile time for those is significant enough to be noticed but not significant enough to be a problem. Because of the great composability of Julia, I'm guessing internally its using those big libraries and thus find most stuff precompiled for them. But I can't be sure about that.

Anyways, this is just my experience and my job involves a lot of waiting and stuff anyways so a couple seconds here and there doesn't bother me.

Re:Data Science in Julia for Hackers by andi999 on Saturday March 20, 2021 @05:26AM (#26521817)
To me separating compiler and interpreter looks like a new two languages problem (maintaining consistency seems difficult)
Re:Data Science in Julia for Hackers by jakobnissen on Saturday March 20, 2021 @06:38AM (#26522082)
It would be the same code running on two different backends, so there would not be a two-language problem. Just like how GCC and Clang don't give C a two-language problem.
Re:Data Science in Julia for Hackers by andi999 on Saturday March 20, 2021 @06:46AM (#26522118)
2 language problem for the Julia developer. Also these two languages might drift apart over time
Re:Data Science in Julia for Hackers by CyberDildonics on Saturday March 20, 2021 @09:20AM (#26523023)
They just explained to you that this idea has nothing to do with two different languages and that there are other examples of having multiple compilers for one language.
Re:Data Science in Julia for Hackers by dTal on Saturday March 20, 2021 @11:49AM (#26523944)
It's not a problem if the language spec is well defined. Scheme distributions often do this.
Re:Data Science in Julia for Hackers by pansa2 on Saturday March 20, 2021 @02:02PM (#26524797)
AFAIK Julia doesn’t even have a well-defined syntax (there’s no specification such as a context-free grammar, only the implementation of the parser).
Re:Data Science in Julia for Hackers by jjoonathan on Wednesday March 24, 2021 @10:17AM (#26567527)
If it worked by default out of the box, nobody would have to "clarify" that you can decrease Julia's computational slowness by increasing the human time and effort spent on cache management

:/

Re:Data Science in Julia for Hackers by alpaca128 on Friday March 19, 2021 @08:29PM (#26519606)
One of the things I took away from trying Julia was that unicode is incredibly dumb in some aspects. Unicode lacks support for parts of the latin alphabet in subscript and superscript formatting(similar for the greek alphabet)[0].

As Julia relies on Unicode for its neatly formatted variable names this is an annoying limitation that the developers can't even do much about.

Unicode has over 100k symbols, including about 3500 emoji. But a continuous set of 26 small letters, either in lowercase or uppercase(or both) is too much bloat apparently.

[0]: https://stackoverflow.com/questions/17908593/how-to-find-the...

Re:Data Science in Julia for Hackers by montalbano on Saturday March 20, 2021 @06:24AM (#26522020)
Julia core developers are at the forefront of trying to push for a better unicode standard:

https://github.com/stevengj/subsuper-proposal

Re:Data Science in Julia for Hackers by cbkeller on Friday March 19, 2021 @09:29PM (#26519959)
I don't mind Julia's Unicode support, but definitely share the gripe about how the Unicode standard doesn't yet support a complete a-z set of sub/superscripts!
Re:Data Science in Julia for Hackers by adgjlsfhk1 on Friday March 19, 2021 @09:07PM (#26519840)
What's the alternative? If you want julia files to be editable by regular programs, I can't think what else you would use.
Re:Data Science in Julia for Hackers by alpaca128 on Friday March 19, 2021 @10:29PM (#26520274)
Which is why I am so disappointed about those gaps in Unicode. Apparently the Unicode consortium doesn't care because in their eyes such things have to be handled by higher level formatting software, but that's not a very convincing excuse imho.

It's just so bewildering when on one hand lowercase superscript is missing exactly one letter for the full coverage, and at the same time Unicode has characters like "Grinning cat face with smiling eyes"(U+1F638). Just what I needed.

It's a bit disappointing because together with the integration in the REPL this feature in Julia works well enough to give a glimpse of the potential but when trying to experiment more it shows gaps that make it a bit of a trial-and-error situation. Better direct support in standardized encodings could make this much more usable and maybe not just in one specific language.

Re:Data Science in Julia for Hackers by adgjlsfhk1 on Saturday March 20, 2021 @12:56AM (#26520890)
IMO, the solution here from unicode's end seems really clear. Just add superscript and subscript modifiers (the same way emoji have skin-tone and gender modifiers). That way, you don't need to add special ones for every character people want different versions of.
Re:Data Science in Julia for Hackers by xiaodai on Saturday March 20, 2021 @05:18AM (#26521787)
How about super and sub scripts for thr 35000 or some Chinese character? I think thr unicode committee made the right call
Re:Data Science in Julia for Hackers by alpaca128 on Saturday March 20, 2021 @09:31AM (#26523113)
How about a single "superscript" and "subscript" modifier that handles any of the other Unicode symbols?

The standard already has enough formatting options to make smartphones crash by sending them a text message(as could be seen multiple times on both Android and iOS).

If you think the unicode committee made the right call, please explain why the decision to add smiling cat pictures and over 10 heart symbols was correct but not supporting everyday maths notation.

Re:Data Science in Julia for Hackers by jonniedie on Friday March 19, 2021 @09:00PM (#26519798)
Julia doesn’t rely on any Unicode. It just gives you the option to use it. If it’s not useful to you, feel free to not use it.
Re:Data Science in Julia for Hackers by Buttons840 on Friday March 19, 2021 @09:35PM (#26519987)
How would one not use Unicode? Every character on my keyboard and screen are Unicode characters.
Re:Data Science in Julia for Hackers by elcomet on Saturday March 20, 2021 @04:48AM (#26521706)
Most of them are ascii as well.
Re:Data Science in Julia for Hackers by chrisjharris on Friday March 19, 2021 @07:54PM (#26519350)
You mean, the time it takes at run-time? I'm not quite sure what you mean - I think Julia's package management is generally better than Python (which is a mess) - it doesn't play well with Nix but I can't really blame it for that.
Re:Data Science in Julia for Hackers by kyllo on Friday March 19, 2021 @07:58PM (#26519371)
I think they're referring to the JIT compilation time. There are some ways to mitigate it, such as creating an image using PackageCompiler.jl, but it's definitely a noticeable issue IME. https://julialang.github.io/PackageCompiler.jl/dev/
Re:Data Science in Julia for Hackers by tasubotadas on Saturday March 20, 2021 @04:06AM (#26521561)
Or the fact that once you define a struct, it cannot be redefined again and you need to reload the repl
Re:Data Science in Julia for Hackers by dunefox on Saturday March 20, 2021 @09:57AM (#26523268)
You can put it in a module, then you can change and reload in the repl without restarting.
Re:Data Science in Julia for Hackers by hntrader on Saturday March 20, 2021 @12:00AM (#26520719)
From a data science perspective do you see any obvious advantages to Julia compared to R/Python?
Re:Data Science in Julia for Hackers by cbkeller on Saturday March 20, 2021 @12:27AM (#26520805)
I think it really depends on what subset of data science you have in mind. For me it solved my personal version of the "two-language" problem, but YMMV. Longer-term I think the most interesting thing about the Julia ecosystem is the composability that comes from dispatch-oriented programming [1]

[1] https://www.youtube.com/watch?v=kc9HwsxE1OY

Re:Data Science in Julia for Hackers by systemvoltage on Saturday March 20, 2021 @02:10AM (#26521149)
Yes. And the warts in the language are pretty off putting.

Original paper was awesome. Execution of the language IMO hasn’t been good despite of great marketing.