4 ms·
Julia does it right, but then also cheats. It uses high performance multi-methods, partially because it's a lisp and common lisp has been optimizing multi-metho
by SolarNet 10y ago
Julia does it right, but then also cheats. It uses high performance multi-methods, partially because it's a lisp and common lisp has been optimizing multi-methods for decades now. But also because Julia has a built in JIT with a very powerful type analyzer. Which means that while every function in Julia is a multi-method, you almost never pay the costs when writing high performance code.
The cheating comes from the run-time compilation features being leveraged to inspect "already compiled" code and dodge around the dispatch. However this causes problems in larger systems (Julia has some serious shortcomings when it comes to large projects, and they ban people who talk about it too much) because if you add a method to the multiple dispatch already compiled functions won't make use of it without recompiling them too, this is basically the expression problem being displayed in a dynamic language (because they choose speed over true dynamicism; they leverage the dynamic features for a different purpose and loose the feature typically gained). This is a very bad form of cheating because multi-methods are often seen as a solution to the expression problem, but Julia still has the problem even though they use multi-methods.
Try the following:
# Library
abstract bar
ex(x) = println("dynamic")
ex(x::bar) = println("bar")
test(x::bar) = ex(x)
type foo <: bar
x :: Int
end
test(foo(5))
# Now our code
ex(x::foo) = println("foo")
test(foo(5))
It should print `bar\nfoo` it doesn't.
- deleted 10y ago[deleted]
- tanlermin 10y agoI think this is slated to be fixed soon. Any reason why it can't be done? https://github.com/JuliaLang/julia/issues/265 https://github.com/JuliaLang/julia/issues/265 Look at the commits at the bottom.
- SolarNet 10y agoIt's probably doable, but also note how they say there will be a performance cost at runtime and it will be everywhere. Like I said, julia is cheating right now with the speed they are achieving while having multi-methods. It can be done, but they will loose their shiny performance numbers, or (for example) have to check to see if you need to recompile their entire standard library when you overload + while not crashing currently executing code. They are playing a shell game with the dynamic calls, and taking up large amounts of memory because of it, this will take up even more memory. And is another reason why Julia is not good for any large code base or doing anything but what the language was designed for.
- tanlermin 10y agoGot it. I'm wondering what this performance cost will be and if significant, can all that brainpower at MIT etc really not find a way to mitigate it? This is a practical question for me because I'm considering Julia for a project and my personal data language. This is the upcoming python alternative ecosystem, also with multi dispatch: https://github.com/libdynd/libdynd https://github.com/libdynd/libdynd https://github.com/numba/numba https://github.com/numba/numba https://github.com/blaze/blaze https://github.com/blaze/blaze
- SolarNet 10y agoI mean scientific computing is what the language was designed for, use it if that's what you need. Just don't expect to be using those shiny numbers for anything but scientific computing (and most specifically when involving large matrices). Their namespacing and modularity is terrible, writing a complex gui, non-trivial web server, 3d renderer, or any sort of real time system is right out. And they seem dead set against changing that (did I mention they ban people for making too much noise about it). But if you want to simulate something over a cluster it's a great choice. I should probably note that I have a poor opinion of their community from my observations (they are hilariously salty), I may be a bit biased.
- tanlermin 10y agoThanks for sharing your thoughts. I want to keep my general code and scientific code in the same language. So python it is.
- simondanisch 10y agoCan you explain why you couldn't write a 3D renderer or complex gui in Julia? As someone who does exactly that it's a bit hard to follow your reasoning...
- SolarNet 10y agoWell, real-time 3d rendering anyway, thanks to the garbage collector and having very little control over it. How complex of a GUI are we talking here? Do you split it into many namespaces? Have long load times when not on a powerful dev machine? Ever tried to deploy said GUI? Do the right thing when exceptions in your program happen, or does it just crash the GUI or spit you out to the repl? Because I'm betting your GUI is not meant to be used by anyone but a couple of people with familiarity with the system, which is fine, but not generally what a GUI is made for.
- StefanKarpinski 10y ago> Julia has some serious shortcomings when it comes to large projects, and they ban people who talk about it too much Only one person has ever been banned on GitHub and it was not for talking about any shortcomings. That person is still allowed to and regularly does post on Julia mailing lists – no one has ever been banned from mailing lists.
- SolarNet 10y agoShrug I've never seen the mailing lists for Julia, I just recently started reading the github every now and then because it is an interesting language, and I like seeing the development of it. But ~~your community is~~ you are one of the most hilariously salty one's I've ever watched. And sorry but it does look like you banned him for being pushy about the problems making modular software, and doing real development with the language. Which I note you don't dispute.
- simonster 10y agoHN is not the right forum for this, but that's definitely not why he was banned.
- deleted 10y ago[deleted]
- ihnorton 10y agoThe main mailing list is here, people can judge for themselves: https://groups.google.com/forum/#!forum/julia-users https://groups.google.com/forum/#!forum/julia-users Here's a recent (and typical) example of a lengthy series of technical and sometimes pointedly-critical questions: https://groups.google.com/forum/#!searchin/julia-users/%22verna%22%7Csort:date https://groups.google.com/forum/#!searchin/julia-users/%22ve...