News for hackers. Stuff that matters.
Re:Julia 1.6: what has changed since Julia 1.0? by DNF2 on Sunday February 14, 2021 @12:09PM (#26134000)
I cannot fathom how ttfp is important. It's time to first plot, not to every plot. After it's down to ~10 seconds, why on earth does anyone care?
Re:Julia 1.6: what has changed since Julia 1.0? by enriquto on Sunday February 14, 2021 @12:31PM (#26134210)
> I cannot fathom how ttfp is important.

I personally do care for my concrete usage pattern.

This is my use case: A long shell script that does a lot of things. At some point, inside a loop that runs hundreds of times, it needs to solve a couple of small linear systems and plot a simple graph. There's hundreds of png graphs, that are then combined into a video sequence. Right now, the computation is done by calling octave (inside the loop) and then gnuplot (to create the actual graph from the octave computed data points). I would like to replace each call to octave+gnuplot to a single call to julia. Yet, this would make my script run in a few hours instead of a few seconds, because for this usage pattern all plots are first plots

Before you suggest that I should rewrite the whole thing in julia, maybe you are right but

1) it would take me a few weeks that I don't have

2) that's not my point. A good tool is a tool that can be used for purposes that it was not intended to, like this. If the time to first plot in julia was a millisecond instead of 10 seconds, then julia would be a much better tool.

Re:Julia 1.6: what has changed since Julia 1.0? by stillyslalom on Sunday February 14, 2021 @12:46PM (#26134368)
You may want to look at [DaemonMode.jl](https://github.com/dmolina/DaemonMode.jl), which spins up a persistent Julia process in the background so you don't have to pay the TTFP penalty more than once, even when shell-scripting.
Re:Julia 1.6: what has changed since Julia 1.0? by jarvist on Sunday February 14, 2021 @04:12PM (#26136301)
As you already have the gnuplot commands, perhaps using Julia + https://github.com/gcalderone/Gnuplot.jl might work? It's a very lightweight package, so even using it directly should be OK.

I do all my plotting with Gnuplot.jl, as gnuplot is fast, and I can save .gpt files which reproduce the plots for later reference and making publication-quality.

Re:Julia 1.6: what has changed since Julia 1.0? by DNF2 on Sunday February 14, 2021 @12:46PM (#26134365)
But this is really the worst conceivable use case for Julia. Why are you interested in making this change, when Julia offers no advantage in this scenario?
Re:Julia 1.6: what has changed since Julia 1.0? by enriquto on Sunday February 14, 2021 @02:57PM (#26135658)
> Why are you interested in making this change, when Julia offers no advantage in this scenario?

Well I love julia the language. It's the interpreter quirks that I find annoying. If julia had something lean and superfast like luajit it would be incredible!

Re:Julia 1.6: what has changed since Julia 1.0? by The_rationalist on Sunday February 14, 2021 @07:08PM (#26137539)
If only they could switch to graalvm :m
Re:Julia 1.6: what has changed since Julia 1.0? by whateverwhynot on Sunday February 14, 2021 @03:14PM (#26135822)
I'm not the parent, but I faced exactly the same issue when I tried to switch to Julia from scilab. As for why I'd like to switch: Julia is a better language, it is way easy to run your script on a cluster and I've been bitten more than once by the two language problem... So Julia seems better for everything but for one of my most common use cases...
Re:Julia 1.6: what has changed since Julia 1.0? by aliceryhl on Sunday February 14, 2021 @02:27PM (#26135349)
It would be a perfectly fine use-case for Julia if it wasn't so damn slow.
Re:Julia 1.6: what has changed since Julia 1.0? by stjohnswarts on Sunday February 14, 2021 @02:59PM (#26135673)
I still have a soft spot for octave. It was my first matrix oriented program. I've moved on to pandas and c++ but I still pull up octave for signal analysis because it's just plain easier and has some great functions and I think it may have created folds in my brain as an EE undergrad that will always be there :)
Re:Julia 1.6: what has changed since Julia 1.0? by cbkeller on Sunday February 14, 2021 @12:35PM (#26134257)
It’s not trivial to do, but compiling plots into your sysimg might actually fix that
Re:Julia 1.6: what has changed since Julia 1.0? by enriquto on Sunday February 14, 2021 @12:36PM (#26134268)
Thanks! Is there a way to compile all installed packages into the sysimage? If so, why isn't that the default?
Re:Julia 1.6: what has changed since Julia 1.0? by cbkeller on Sunday February 14, 2021 @12:45PM (#26134350)
Technically yes, but then IIRC you’d have to recompile the whole sysimg any time you update any single package, which could get to be a pain. The usual compromise seems to be to include just a handful of your most used packages in the sysimg (say Plots + Revise)
Re:Julia 1.6: what has changed since Julia 1.0? by enriquto on Sunday February 14, 2021 @12:55PM (#26134444)
> you’d have to recompile the whole sysimg any time you update any single package

Are there any downsides to this? You never care how long does a system update take. You always care how long do your programs run.

Re:Julia 1.6: what has changed since Julia 1.0? by Sukera on Sunday February 14, 2021 @02:21PM (#26135305)
The downside is that PackageCompiler (or SnoopCompile, for that matter) can only pack into the sysimage what it sees. This is usually done by "recording" which methods get called during a session and putting the compiled native code for those into the sysimage. If it's not called during setup, you'll still have dynamic compilation (as for any code that hasn't ever run).
Re:Julia 1.6: what has changed since Julia 1.0? by cbkeller on Sunday February 14, 2021 @02:11PM (#26135170)
I’ve never tried it myself, but can’t think of any reason why it wouldn’t work in principle if you do want to go that route
Re:Julia 1.6: what has changed since Julia 1.0? by sgt101 on Sunday February 14, 2021 @02:10PM (#26135167)
Could you cache the requests or write the parameters into a file and then make the call to Juila, and ask it to loop over the requests?
Re:Julia 1.6: what has changed since Julia 1.0? by saiojd on Sunday February 14, 2021 @01:05PM (#26134533)
You can't possibly be serious. As things stand, even just redefining a struct field requires restarting the interpreter, which forces you to wait ~10-30 seconds for everything to compile, over and over again. Maybe you only use Julia for small scripts, and can afford to never restart the interpreter?
Re:Julia 1.6: what has changed since Julia 1.0? by fishmaster on Sunday February 14, 2021 @01:48PM (#26134946)
> even just redefining a struct field requires restarting the interpreter

It really doesn't if you use a module.

Re:Julia 1.6: what has changed since Julia 1.0? by saiojd on Sunday February 14, 2021 @06:11PM (#26137198)
I mean, I still need to recompile the module no? Or do you split your project into several small modules to avoid this? (I've avoided this so far as I found the module system a bit tedious tbh, as it requires to explicitly list everything you need to export, as well as manually import stuff from the parent module).
Re:Julia 1.6: what has changed since Julia 1.0? by fishmaster on Monday February 15, 2021 @04:59PM (#26148055)
Usually as long as I develop I have structs that I change inside a small module, then I can recompile just the module and access the new struct, e.g. for neural networks.

It's not perfect but it's something.

Re:Julia 1.6: what has changed since Julia 1.0? by saiojd on Tuesday February 16, 2021 @07:46PM (#26161089)
Useful trick, I'll try that, thanks.
Re:Julia 1.6: what has changed since Julia 1.0? by the-smug-one on Sunday February 14, 2021 @01:39PM (#26134863)
Dang, why can Common Lisp do this so well and Julia so poorly?
Re:Julia 1.6: what has changed since Julia 1.0? by eigenspace on Sunday February 14, 2021 @01:53PM (#26134988)
The assumptions our compiler is able to make about types never changing (and a few other restrictions) allows for a lot of optimizations in julia that are not possible in Common Lisp. Julia's compiler is able to do a few things significantly more aggressively than CL.

That said, there is some very interesting work happening on getting around these restrictions. There was a PR from Tim Holy a while ago that could have allowed it, but there were some problems with the PR, and there were also some associated costs that were deemed too steep to pay.

That said, there's other great work on other ways around this. For instance, you can dynamically redefine structs all you want in Pluto.jl notebooks and there's no performance penalty!

This is something that kinda just fell out as a natural consequence of it's reactive design.

Re:Julia 1.6: what has changed since Julia 1.0? by whateverwhynot on Sunday February 14, 2021 @03:06PM (#26135745)
Well, with Julia it is time to first plot for every new session. So if your typical workflow is to start Julia and just do a single plot of the recently acquired data (quite common workflow in my field), Julia is an order of magnitude slower than python or scilab.
Re:Julia 1.6: what has changed since Julia 1.0? by cbkeller on Sunday February 14, 2021 @03:46PM (#26136109)
If that’s your workflow it would probably be highly advisable to compile plots.jl into your sysimg
Re:Julia 1.6: what has changed since Julia 1.0? by walshemj on Sunday February 14, 2021 @12:34PM (#26134251)
Me too not to go all four yorkshire man here, but I can remember when you would have to write your own plotting programs in Fortran and then wait for the pen plotter to slowly draw your plot.

And not that long before that you would print the results out and manually plot them on graph paper.