14 ms·
Julia 1.5 Highlights
- xiphias2 6y agoThanks for the hard work! It sounds great, especially the allocation optimizations. I didn't know why my code using views allocate memory, so I rewrote all my performance critical functions to return iterators (which is not that bad, as Rust uses lots of iterators, just Julia standard library is not optimized for them). At least now I understand what was the issue. Regarding thread-safety I started writing a borrow-checker macro as a hobby, as I have been bitten by accessing mutable data structures from multiple threads. It's great that the macro and type system is so flexible that it can be done without modifying the language.
- randyzwitch 6y agoLooks like a lot of great content and updates/announcements came out of JuliaCon last week
- muska3 6y agoThey should really list all the contributors that added to the release instead of highlighting the few people that added some of the listed features.
- StefanKarpinski 6y agoThat’s a good idea, although this is a highlights blog post, not intended to list all the changes. For that you can look at the 1.5 release notes: https://docs.julialang.org/en/v1.5/NEWS/ https://docs.julialang.org/en/v1.5/NEWS/
- UncleOxidant 6y ago> "The return of "soft scope" in the REPL" I'm a little nervous about code in the REPL and code in a file behaving differently. I think they should go back to the 0.x scoping rules everywhere consistently - which was lexical scoping, IIRC. Which brings up a question: if this behavior is context dependent (different in REPL and in a file) does that mean you can set a flag so that code in a file behaves like code in the REPL?
- dunefox 6y ago> Make the REPL behave like IJulia, and Julia versions 0.6 or earlier. > Keep the 1.0 behavior in files, to avoid breaking anybody's code. > Print a warning if code in a file would behave differently than in the REPL, requesting an explicit local or global declaration to disambiguate the variable in the loop.
- StefanKarpinski 6y agoAs noted in the rewritten scope docs at https://docs.julialang.org/en/v1/manual/variables-and-scoping/#Local-Scope-1 https://docs.julialang.org/en/v1/manual/variables-and-scopin...: > An important property of this design is that any code that executes in a file without a warning will behave the same way in a fresh REPL. And on the flip side, if you take a REPL session and save it to file, if it behaves differently than it did in the REPL, then you will get a warning. So there's no real danger of deviating behavior unless you're in the habit of ignoring warnings. As to why bringing back 0.x scope rules is not a good idea, this post explains why it was changed in the first place: https://discourse.julialang.org/t/explain-scoping-confusion-to-a-programming-beginner/43206/22 https://discourse.julialang.org/t/explain-scoping-confusion-.... In short, for non-toy programs, it's a significant source of hard-to-find bugs. Also: changing this behavior in non-interactive contexts would violate the semantic versioning compatibility commitment of 1.x releases. Of course, 1.5 does sometimes introduce a warning in existing code, but (a) it will keep working the same way it did only with a warning and (b) this only happens if you had a global implicitly shadowed by a local, in which case there's a large chance your code was actually broken. Give it a try. A lot of time and thought was put into this change and we believe the new design is pretty much locally optimal. It preserves the safety of the 1.0 behavior for non-interactive programming while recovering the convenience of the 0.x behavior in the REPL.
- UncleOxidant 6y ago> 0.x scope rules... In short, for non-toy programs, it's a significant source of hard-to-find bugs. It seems like a lot of languages have lexical scoping which IIRC was what 0.x had. (Scheme, Lisp, OCaml are a few examples) Are there aspects of Julia that make lexical scoping particularly problematic? Julia 1.x scoping rules look similar to Tcl's.
- daxfohl 6y agoHow does rand get faster? I would think rand would be so well explored that all mature languages reuse the same implementation. Is it written in C or assembly, or does it ccall, or is it written in Julia itself?
- coliveira 6y agoI don't know Julia's implementation, but random number generation is far from being standard across languages. There are several algorithms with their own pros/cons, and as architectures change, so change the requirements on good random number generators.
- hellofunk 6y ago> I would think rand would be so well explored On the contrary, random number generation has no general solution and remains an active area of research in many fields that depend on it.
- pletnes 6y agoAlso, different use cases put focus on different quality measures - period, correlations between each generated number, performance... there is room for many useful algorithms.
- igg 6y agoIt is Julia all the way down. julia> @which randn(1000) randn(dims::Integer...) in Random at ~/Software/Julia/share/julia/stdlib/v1.5/Random/src/normal.jl:210 julia> @edit randn(1000) # Opens the normal.jl file in your editor julia> @run randn(1000) # Starts the debugger in VSCode Digging deeper, at least one of the PRs [1] is based on a 2018 paper [2] [1] https://github.com/JuliaLang/julia/pull/29240 https://github.com/JuliaLang/julia/pull/29240 [2] https://arxiv.org/abs/1805.10941 https://arxiv.org/abs/1805.10941
- techwizrd 6y agoI'm very happy that using views no longer forces allocations. I like that I can choose both performant _and_ safe, rather than being forced to make a choice. Kudos to everyone who contributed to yet another great release!
- mfsch 6y agoStack-allocated views are a big deal! Even in code where the direct cost of the view allocations is acceptable (e.g. because the work per view is high), they should help a lot. Unnecessary allocations are one of the easiest way to accidentally mess up performance in Julia, but having all the views allocated made it much harder to find “problematic” allocations that scale with the problem size. Now it should be more realistic to aim for zero allocations in performance-critical code without giving up the nice ergonomics of views.
- doublesCs 6y agoDo you wanna say a few more words about this? I thought that `v[1:10]` always causes allocation but `view(v, 1:10)` never does. Is this not the case, or has this changed?
- mfsch 6y ago`view(v, 1:N)` did cause an allocation in previous versions, but the allocation was a small, fixed size while `v[1:N]` would allocate memory proportional to `N`. From what I understand, this was required to avoid garbage collection of `v` in cases where the view would be the only remaining reference to that array. In 1.5, changes to the GC allow views to be placed on the stack now.
- LolWolf 6y agoHonestly, this is truly amazing. I will take a quick moment to thank the Julia developers (and all the contributors) for such an awesome language—honestly, if you do any kind of scientific computing (at all) I really and truly recommend trying out Julia. The REPL and development loop are each a little different than the usual Python/R/etc., but it's such a cool language and it's so fast that it will feel like an incredible breath of fresh air. It's amazing to realize that writing down the first thing that comes to your head is usually like 80% as fast as a good, performant implementation. (As someone who has done a decent amount of work in performance engineering for embedded platforms, I really enjoy squeezing out the last drop of performance from most programs, but doing this for every single first-pass at a program, like in Python, is rather annoying if this is what is needed to get a usable implementation.) Anyways, big props to the developers and contributors, even if this is just a "minor" release. I'm extraordinarily excited for the future of Julia and hope it continues to grow and be as awesome of a community as it is! :)
- mfsch 6y agoOne thing to note is that it’s worth learning a little bit about how to write performant code in Julia and how to correctly measure its performance when evaluating the language. It’s common for people to underestimate the performance benefits in their first experiments. There are a few common issues: 1) You measure compilation plus execution instead of just execution. 2) Your code relies on global values that limit optimizations. 3) Your code doesn’t allow the compiler to determine all the types. 4) Your code forces allocations for intermediate values. Especially 4) makes a big difference when you’re coming from NumPy or MATLAB. If you have a chain of vectorized operations (e.g. “X = α * A + β * B + γ * C”), the performance is quite similar between the languages, but in Julia you can enforce that these happen in-place with a single fused loop and zero allocations (e.g. adding “@.” in front). This can often give you another ~2x–10x speedup and make the difference between “similar to NumPy/MATLAB” and “similar to C/Fortran”.
- fermienrico 6y agoPersonally, every time I try to delve into Julia, I am reminded by the massive ecosystem that exists around Python. Speed takes a backseat, instead enormous ecosystem makes Python indispensable and Julia a fringe language despite of its growing popularity. Say you have a database, and need pull data, do some heavy math computation, then present this data in a pdf report with a QR code, pulling images and processing them in the report. In Python, it is without bells and whistles: psycopg2, numpy/pandas, reportlab and may be use PIL. Wanna stick this on S3? boto3. In Julia, it's all very fragmented. LibPQ is immature, DataFrames.jl is nice, ??? (what pdf conversion tool?), images.jl (300 stars), qr code generator? The problem is not the speed with most tasks. The problem is availability of tools. I am sure that will come with it, but why not just use Python at that point? I am not a fan of Julia and that's nothing to do with its features. It has immature ecosystem, with terrible IDE support (Atom/Juno raises my blood pressure), debugging is painful if non existent, error messages are all over the place, everything falls apart as the immature dependencies change and error messages don't help at all. Julia is fun in your jupyter notebook. If you try to build apps in production environment in my team, expect push back if not straight up refusal to initiate such a project in the first place. Syntax was amazing around 0.4v and it went downhill from there. I am sure someone is going to nitpick my comment and provide a way to do it in Julia, but that's missing the point. The point is Python is miles ahead of what it does. In production systems, robustness + maturity matters. Also, don't forget ancillary aspects of a programming language. When we put a python repo together, I am rewarded by an endless supply of developers that I can hire and immediately work on it. With Julia, the supply of engineers is limited and it is such a pain to train people to use it, learn its quirks, spend nights and weekends fighting with it and the business doesn't give a fuck about it.
- coliveira 6y agoI'm glad to see that they are making improvement to latency issues. It has always been an issue for me the fact that you need to way several seconds for basic packages to load. I don't think you need to pre-jit so much code to make this work.
- elcritch 6y agoMy take is that it’s an engineering polish type of problem. The infrastructure was there but it needed profiling and tuning, so they just need some focus on the issue.
- heyitsme 6y agoPeople are being downvoted to oblivion for mentioning this, but for some of us coming from different languages, it definitely takes some time to get used to things. I'm new to julia, so am probably more ignorant about this than most... but importing two packages such as DifferentialEquations and Plots, on my very modern machine takes ~30seconds (this is after they've been "precompiled"). I'm curious, assuming I haven't installed anything new, or haven't changed my installation, why does julia not cache this complied binary somewhere? It seems like this long step has to happen on each new-kernel import, but perhaps it could be avoided? Having an option flag that would cause julia to redo the compilation (because the user has, say, changed something about their installtion), seems like a simple solution. What am I missing?
- Sukera 6y agoThere will be more caching in the future, but until then it sounds like you'd like PackageCompiler.jl (https://github.com/JuliaLang/PackageCompiler.jl https://github.com/JuliaLang/PackageCompiler.jl) to build DiffEq and Plots into your sysimage.
- kristofferc 6y ago> but importing two packages such as DifferentialEquations and Plots, on my very modern machine takes ~30seconds (this is after they've been "precompiled"). FWIW, it is quite significantly improved in the upcoming 1.6 release. 1.5: julia> @time using Plots 8.859293 seconds (15.99 M allocations: 913.783 MiB, 3.86% gc time) julia> @time using DifferentialEquations 25.394033 seconds (58.78 M allocations: 3.222 GiB, 3.96% gc time) latest master: julia> @time using Plots 3.957724 seconds (7.67 M allocations: 537.424 MiB, 5.50% gc time) julia> @time using DifferentialEquations 9.708388 seconds (23.08 M allocations: 1.537 GiB, 6.20% gc time)
- deleted 6y ago[deleted]
- m0zg 6y ago> the time to generate the first plot goes from 11.7 seconds to 7.8 seconds This should not take more than 100 milliseconds in this day and age, folks.
- gajomi 6y agoFYI this is the _first_ call which is dominated by the JIT process. So not really "this time to plot" so much as the "time to compile". Calls to the resulting jitted function will be on the order of what you quote (I have not timed myself for the specific result they quote here but have done for similar in the past).
- m0zg 6y agoI know. Be that as it may, 7 seconds to load a module alone is nuts.
- Certhas 6y agoThe module also gets partially precompiled on load. If you make the module part of the systemimage it's as quick as you would expect.
- jkinudsjknds 6y agoDoes that just move the load time to the initial start up of the REPL before calling 'using Plots'? If not I'm surprised I've never seen that advice before.
- bananaquant 6y agoHa. I remember the time when it took over a minute.
- muska3 6y agoSadly, this is very true. Yeah Julia is fast, but not as fast as python and matlab in the REPL and quick analysis work. I can get going with data analysis and plotting far faster for exploratory work due to the zero precompilation overhead in those languages, where as in Julia this overhead is brutal. Julia people will probably down-vote this, but sadly, as an interactive language this is it's Achilles heel. I have to explain to people why the code is taking so long to show up due to JIT et al., and non-experts don't understand that this is just an initial overhead.
- newen 6y agoVery glad Pkg is moving away from github. Hopefully, I can now use Julia in an airgapped computer by downloading all the available packages locally like I can do with conda.
- natemcintosh 6y agoI would like to use Julia on an airgapped computer too, but have struggled to figure out how to get packages on it in the past. Could you explain a little more how this might get easier with 1.5?
- newen 6y agoWhat I've been doing so far is have a parallel computer to my airgapped one, installing all the packages that I could possibly want in the parallel computer, copying the .julia folder to the airgapped one, and then crossing my fingers that I won't need any other package. In the article, they said all the packages would be in tarballs and in their Pkg server. I haven't explored this yet but what I'm hoping to do is download all the packages from the links in the package registry, and then point the Pkg client to my local drive somehow.
- staticfloat 6y agoThe PkgServer is an open source caching server, available here: https://github.com/JuliaPackaging/PkgServer.jl https://github.com/JuliaPackaging/PkgServer.jl The PkgServer protocol serves content-addressed chunks of data to Julia Pkg clients, so to download a certain version of a package, the Pkg client will request things like `GET /package/${pkg_uuid}/${content_hash}`. If you can pre-fill a PkgServer with all of the packages that you want, then it can serve a client just fine. The full design is that there are a small number of "Storage Servers" that continually explore the global registry of packages (called `General`, located here: https://github.com/JuliaRegistries/General https://github.com/JuliaRegistries/General), downloading and storing tarballs for every version of every package that is available. These storage servers store everything forever, while Pkg servers contain an LRU cache to allow them to be deployed close to whatever compute resources will be requesting packages. For an airgapped solution, you could generate a static snapshot of some selection of the packages you want to serve, then serve them with nginx and point to that "static storage server" with the opensource Pkg Server, and it would all "just work". An example of how to generate a static storage server is here: https://github.com/JuliaPackaging/PkgServer.jl/blob/master/bin/gen_static.jl https://github.com/JuliaPackaging/PkgServer.jl/blob/master/b..., you would serve the resultant directory structure with something like nginx, then point the Pkg Server to that server as the upstream storage server. I will note that Julia Computing offers an enterprise solution for dealing with secure/restrictive environments called JuliaTeam which provides this in a convenient, managed bundle, along with many other useful features. EDIT: Ah, I forgot to mention, Stefan and I gave a talk at JuliaCon 2020 that touches on some of this, here's a link to the timestamp of the relevant section: https://youtu.be/xPhnJCAkI4k?t=350 https://youtu.be/xPhnJCAkI4k?t=350 And for more info, here's the original planning issue (note some things have changed as we've implemented it over the last year, but the bones are the same): https://github.com/JuliaLang/Pkg.jl/issues/1377#issue-492482336 https://github.com/JuliaLang/Pkg.jl/issues/1377#issue-492482...
- ViralBShah 6y agoOne of the things that the 1.5 release notes does not mention is the huge amount of progress on the Julia GPU compiler. This doesn't get included in the language release notes because the GPU compilation capabilities are provided as a separate package in CUDA.jl. It was great to see so many JuliaCon talks last week using these GPU capabilities.
- wadkar 6y agoWait, does that mean GPU support includes NVIDIA only or will it also include (hopefully in future) ATI as well?
- KenoFischer 6y agoNVIDIA is the most mature, but AMD and Intel are in development
- ChrisRackauckas 6y agoAMD is quite good already. The ROCm stuff works quite well.
- eigenspace 6y agoUnfortunately though, they're dragging their feet on supporting their current generation of consumer grade GPUs. It seems currently, they're not going to support compute on consumer grade gaming GPUs and instead force people to use enterprise grade ones if they want ROCm which is terrible. For reference, the maintainer of AMDGPU.jl can't upgrade to a new AMD GPU or he won't be able to use ROCm. https://github.com/RadeonOpenCompute/ROCm/issues/887 https://github.com/RadeonOpenCompute/ROCm/issues/887
- ezluckyfree 6y agoThe AMDGPU.jl people get a lot their funding from DARPA, as the US government apparently purchased a supercomputer with AMD GPUs.
- mi_lk 6y agoWhat are some industry players using Julia heavily? Can't find the info the the website. Still have the impression that it's mostly used by academics or niche audience, would be happy to be proven wrong
- moelf 6y agohttps://juliacomputing.com/industries/banking-and-finance https://juliacomputing.com/industries/banking-and-finance
- mi_lk 6y agothanks, looks like I didn't look hard enough ... https://juliacomputing.com/industries/ https://juliacomputing.com/industries/
- otoburb 6y agoThe case studies section[1] highlights some industry players using Julia in precision instances, such as the New York Fed, Pfizer, Astrazenca, Aviva, Lincoln Labs, NASA, Cisco, IBM, etc. [1] https://juliacomputing.com/case-studies/ https://juliacomputing.com/case-studies/
- eigenspace 6y agoVersion 1.5 is an awesome release with some really nice stuff. That said, I can't help but feel frustrated by all the attention and effort being poured into compiler latency. I get that some people value it very highly, but to me it just seems silly to put so much effort towards this big group of whiners who find it unacceptable to wait __ seconds for the compiler to run before their first plot is produced (especially when PackageCompiler.jl exists!). To me, the important thing about julia is runtime performance. I'd gladly pay hefty compile times to have even minuscule runtime improvements. To be clear, I'm not saying the Julia devs have been ignoring runtime performance, far from it, but I just sometimes feel the need to chime in like this because I often feel the compiler latency complainers are disproportionately squeaky wheels, so I'd hate to see that cause the devs to over-correct.
- celrod 6y agoI don't really want to sacrifice runtime performance for compile time performance, so long as the compilation time is "reasonable", but so far we've mostly been having our cake and eating it too. The eliminating-invalidations work for Julia 1.6 is a great example of that. When it comes to explicit trade-offs, like setting the optimization level, they've given us finer control by letting us specify it at the module level. Now Plots.jl can favor compile time, while I'll numerical libraries can favor runtime.
- eigenspace 6y agoRight, so what I'd say is that while latency improvements and runtime improvements to julia aren't necessarily in conflict, the core developer's time is a zero sum competition between these things (among others). I'm just saying that for selfish reasons, I'd rather they spent their time on runtime and infrastructure improvements than reducing compile times. And of course, I say this while acknowledging that I am in no position to demand how they spend their time.
- ChrisRackauckas 6y agoSometimes aspects that help the community are a better long term investment, and I think that most people would point to compile times as the key thing to nail down in order to grow the community at a faster rate.
- pjmlp 6y agoCongratulations, lots of nice improvements.
- kndjckt 6y agoDoe anyone know of a good ORM for Julia? This has been holding back my adoption of Julia for a few projects edit: for those who don't know what an ORM is https://stackoverflow.com/questions/1279613/what-is-an-orm-how-does-it-work-and-how-should-i-use-one https://stackoverflow.com/questions/1279613/what-is-an-orm-h...
- eigenspace 6y agoCould you clarify what you mean by ORM? You're more likely to get high quality responses if people know what you mean.
- kndjckt 6y agoadded! Thanks! :)
- karbarcca 6y agoI made https://github.com/JuliaData/Strapping.jl https://github.com/JuliaData/Strapping.jl, which is part of an ORM; i.e. it does the translating between Julia objects/vectors of objects and 2D tables. But it doesn't do some of the more "magical" things like SQL generation, automatic migrations, etc. I think it'd be cool to do some of the SQL generation stuff, but no one has sat down to design something out and how it would work in Julia.
- leanthonyrn 6y agoRacket and Julia on the same day!
- deleted 6y ago[deleted]
- dunefox 6y agoRacket is another language that is seriously cool.
- deleted 6y ago[deleted]
- vsskanth 6y agoWondering if one can make static binaries in Julia yet ?
- dklend122 6y agoYou can precompile a binary that bakes in the compiler and distribute that. Slimmer separate compilation is on the roadmap
- FridgeSeal 6y agoHave any details around the slimmer separate compilation you mentioned?
- aborsy 6y agoI don’t see why would anyone use Matlab in place of Julia in 2020 (unless one really needs one of those specialized toolboxes). Julia does the same things, faster and better, and literary with the same syntax. That being said, python with numpy has got really fast. If you stay within numpy, and are careful with loops, or if numba works for your code, don’t expect much improvement.
- deleted 6y ago[deleted]
- smabie 6y agoThe problem with Python is that you have to bend over backwards to make sure everything you're doing is vextorized or the performance falls off a cliff. With Julia, you can just code naturally. It's really freeing.
- DNF2 6y agoThe answer to this is simple: inertia. Our customers use Matlab, our colleagues do, all our code, built up over years, is Matlab. Learning a new language incurs a cost, with somewhat unknown long-term payoff. Julia is, in my opinion, far superior to Matlab (and also better than Python), but I'm stuck with Matlab (and a bit of Python) because of those things.
- shaklee3 6y agoHow are the plotting capabilities of Julia compared to MATLAB?
- tastyminerals2 6y agoOk, I think I got the picture now. You should find Julia interesting! If you prefer dynamic languages and interested or do scientific programming. If you need your code to run LLVM fast. If you have a lot of RAM and can live with "warm-up" lags. If you are comfortable with MATLAB syntax.