Hacker News new | past | comments | ask | show | jobs | submit login
Julia's latency: Past, present and future (viralinstruction.com)
13 points by jakobnissen on March 31, 2023 | hide | past | favorite | 4 comments



Another great post, keep it up Jakob.


Very interesting, thanks for the writeup and work on benchmarking all of this. I suspected package loading had gotten slower from 1.0 to ~1.7, but 1.9 will solve most concerns.


It will certainly reduce latency by a few fold - but many users might not find that that is enougj to solve theirs latency concerns.

TTFP for Makie is still well over 10 seconds, so it'd need to get more than 10x better still before it's in the same league as Python.


I don't think we've seen the final state of it though. v1.9 really gives people the proper tools for solving latency problems. Before, invalidations hurt a little, but it was also kind of a wash because LLVM code didn't precompile, so you could spend time setting up a Snoopprecompile and fix some invalidations and end up LLVM bound saving 1 second out of 20. But with package images it's almost always better to fix precompilation. The only thing hampering time much now is the `using` time went up, but as mentioned in the Reddit post there's a lot of ideas for what to do there. The other thing is package extensions, which cut down the amount of code to load. There's tons of PRs floating around the ecosystem turning things into extensions, and thus cutting down the overall code that is actually ran and loaded.

This means that in a few months, people will start to see some major tangible benefits from following the compilation improvement practices laid out here and https://sciml.ai/news/2022/09/21/compile_time/. I think then you'll have a lot more people start to take all of these new tools seriously and it will be standard to incorporate them into packages. Right now they are still kind of niche things for packages with known TTFX problems, but I think come v1.9 you'll see every major package use all of these methods.

> Different packages are affected differently

I think this is one of the pieces that's effected by this. I don't think "Julia has become optimised for running Plots.jl" is quite correct. Julia's compilation and runtime is much more optimized for well-inferred code, which Plots.jl is not. However, the compiler developers have been using Plots.jl as a test case for all of these new tools, and therefore its SnoopPrecompile and invalidations have gotten some dramatic improvements because those required ecosystem changes I mentioned are being done by the compiler team for this specific package. Plots.jl had things like precompilation snooping way back before there was even a package for it, the earliest I know of was around v1.0. Meanwhile, DataFrames.jl only setup its precompilation snooping 7 months ago (https://github.com/JuliaData/DataFrames.jl/pull/3182), which I would presume was just in time for the v1.8 mark on your plot and is one of the big reasons for having a sudden drop (which continues into v1.9 because of package images).

What I mean to say then is that, I think all packages will get the improvements we've seen from Plots.jl, but package authors will need to update their packages in order for that to happen. Some packages have already done this, many have not.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: