News for hackers. Stuff that matters.
Re:Julia 1.6: what has changed since Julia 1.0? by Sukera on Sunday February 14, 2021 @11:42AM (#26133773)
I know that there are plans to cache even more, but other than that I can basically only recommend to put distinct projects into proper projects (with a module and Project.toml). That will already cache precompiled code for that module, even between sessions. Having things in a script won't have that benefit. For experimenting with struct layouts, I've found that NamedTuples (https://docs.julialang.org/en/v1/base/base/#Core.NamedTuple) are amazing for prototyping, since they can be accessed via A.b just like structs but don't have the limitation of being const global.

The dynamism and flexibility combined with the compilation model is basically what leads down this path of recompilation, unfortunately. Since importing packages may change behaviour/invalidate some compiled method (that's what the SnoopCompile stuff in the article was about), it's nontrivial to just begin caching things left and right. You'd end up with an exponential explosion in the number of methods to cache, wasting huge amounts of disk space. That's not to say that there aren't more things that could be done, just that it's hard to do so.

Re:Julia 1.6: what has changed since Julia 1.0? by saiojd on Sunday February 14, 2021 @01:01PM (#26134492)
I've read a bit on type invalidation and I know it's a hard problem (in fact it's hard for me to even wrap my head around it, lol). Still, it's unfortunate. One thing I would like to know is if the difficulties with invalidation are a symptom of the dynamic semantics, or of the compilation model.

Namedtuples are cool, but I'm not sure I understand the tradeoffs between using them and using structs. Can I just replace all structs in my project with named tuples, without having a performance hit?

Re:Julia 1.6: what has changed since Julia 1.0? by Sukera on Sunday February 14, 2021 @02:10PM (#26135164)
Note that I didn't suggest replacing structs with NamedTuples entirely - only during prototyping, while you're figuring out what you want your struct to look like. Structs most definitely will be faster.
Re:Julia 1.6: what has changed since Julia 1.0? by saiojd on Sunday February 14, 2021 @06:02PM (#26137129)
I mean, I could, it's just that its pretty hard to know in advance which structs I will have to modify... Most of the time I only need to do minor edits like add 1 field. By that point I need to recompile anyway if I am to switch to NamedTuples...
Re:Julia 1.6: what has changed since Julia 1.0? by oxinabox on Sunday February 14, 2021 @02:31PM (#26135403)
> Structs most definitely will be faster.

I am not 100% sure this is true.

Structs will definately look cleaner in the code. Not sure they will be faster though.

Re:Julia 1.6: what has changed since Julia 1.0? by saiojd on Sunday February 14, 2021 @06:06PM (#26137153)
Do you know what the differences end up being when it comes to compilation? (not a rhetorical question - I'd like to know)
Re:Julia 1.6: what has changed since Julia 1.0? by oxinabox on Sunday February 14, 2021 @07:23PM (#26137636)
Run `@code_typed` and `@code_llvm` and find out?