19 ms·
Julia Impressions
- idunning 12y agoGreat stuff. I think the author may be using the release version 0.2, as the boot time issue has been rectified now for the most part in the next release, 0.3. The next big slow-load issues is packages, that'll be post 0.3 though.
- srean 12y agoAssuming that this was fixed by caching the machine code, cant the same approach be used for packages ? Or to turn my question around: what is different about packages is it that they are not necessarily written in Julia ? I have still not taken a serious plunge with Julia, testing waters. Any plans for doing the same to individual scripts ? It would be handy to start off from the last known set of JIT'ed functions, may be retiring paths that are no longer frequented.
- ihnorton 12y agoYes - the base image is compiled to a shared library. There is a mechanism for including package/user code in the system image if you compile Julia yourself. It works well with a wide range of packages, but the goal is to generalize this and make it usable with binary releases, and probably to compile packages to separate shared libraries.
- eyeballtrees 12y agoOP here. I'm currently using 0.2, I'll have to upgrade and see if that fixes the issue. Thanks!
- ViralBShah 12y agoThere are two separate issues, I believe you refer to. There is the boot time, which has been considerably improved, and is less than a second. The second thing is the slight pause that you refer to (if I understand the post correctly), when executing stuff the first time. That is the JIT compiling and warming the code cache.
- StefanKarpinski 12y agoThe startup time in 0.3 is more than 10x faster than 0.2 – it's down to ~200 ms on my machine, whereas it was about 2 seconds before. It's now quite painful to go back and use 0.2.
- DennisP 12y agoIs the error reporting improved for 0.3? That was my main problem with 0.2 (on linux). I ran into situations where all I knew was that something went wrong somewhere in my program. I've seen other people make similar comments. (Aside from that I really love the language, and I'm looking forward to doing more with it.)
- idunning 12y agoNot completely. Not an expert on this, but I believe issue at least partially stems from the interaction with the older LLVM JIT we are using. We are moving to the newer LLVM JIT in the 0.4 release cycle and I understand this will address the issue.
- DennisP 12y agoGood news, thanks :)
- CyberShadow 12y agoHow is multiple dispatch different from function overloading, as found in C++/Pascal? Is it the same thing?
- brandonbloom 12y agoDispatch is the process of selecting and executing the matching overload. Multiple-dispatch refers to the ability to select the best overload based on more than just the first argument. C++ can do arity and type-based multiple-dispatch, but only statically. Julia supports dynamic multiple dispatch, where as C++'s virtual methods are only single-dispatch dynamically.
- StefanKarpinski 12y agoPrecisely. This may sound pedantic or academic, but in practice when static overloading and dynamic dispatch differ, the static behavior is usually not what you want. In my experience, this makes it painful to make code that is polymorphic in multiple arguments behave correctly in C++ (double dispatch [1] is one of the necessary but awkward tactics that's used), whereas multiple dispatch just works. And of course, almost working and actually working are a world apart even though they sound so close. [1] http://lostechies.com/derekgreer/2010/04/19/double-dispatch-is-a-code-smell/ http://lostechies.com/derekgreer/2010/04/19/double-dispatch-...
- epidemian 12y agoFrom playing a bit with the Julia REPL (http://forio.com/julia/repl/ http://forio.com/julia/repl/), it seems that the dispatch of the method is dynamic, as opposed to the dispatch of overloaded functions in C++: julia> function foo(s::String) "$(s)!!!" end foo (generic function with 1 method) julia> function foo(n::Int) n + 1 end foo (generic function with 2 methods) julia> foo(rand() < 0.5 ? "Hello" : 41) 42 I'm not used to this kind of dispatch for bare functions, but it seems to me that it could offer similar capabilities to what subtype polymorphism provides in OO†, without having to define new types for this methods to live in or polluting the existing types. † Probably more, as the dispatch can be resolved based on many arguments.
- ninjin 12y agoI really want to get into Julia. As I have been using an increasing amount of numerical code NumPy, SciPy and even my own Cython code has started to fail me performance-wise. The Julia community is really friendly and I tried rolled out a few implementations of the inner-most loop of a Recursive Neural Net in a variety of languages. https://github.com/ninjin/ppod/tree/master/hck/rnn_perf https://github.com/ninjin/ppod/tree/master/hck/rnn_perf Disappointingly enough I was unable to push the performance of Julia beyond that of pure (and ugly) Matlab. I tried asking over at #julia, but it seems that my implementation should be reasonably canonical. This is really a pity for me since I would love to remain highly productive in terms of code and use something scripting-esque rather than have to re-consider going back to C. I have also had a look at Nimrod, but the scientific library support appears somewhat lacking at the moment.
- idunning 12y agoI used Julia's in-built profiler to look at your code. Almost all the work is done, as you'd hope, on lines 20, 22, 33, and 35. I added @inbounds to lines 20 and 35, figuring that line 22 is mostly just the effort of calculating tanh. This dropped the running time on my computer from 10.7 seconds to 6.4 seconds, so about 60% of original running time. If I compile with gcc (gcc rnn_perf.c -O2 -o rnn_perf -lm) and run that, I get 6.2 (O3 is worse). That might not be how you compiled the C version, but regardless it looks like your C time was about 46% of the original Julia time, so its getting close. Three-fifths of the work now is in the tanh line. I'll submit a PR.
- StefanKarpinski 12y agoHaving people like Iain – with this kind of knowledge of numerical programming and optimization – help you out with your code is one of the major benefits of Julia programming :-)
- Bootvis 12y agoThis is some quality advertising on your and Iain's part. It makes me want to use Julia even more when I get the chance.
- zmmmmm 12y agoWhat are the libraries like for Julia at this point? The big thing holding me to R is the breadth of libraries for a) various statistical methods and algorithms and b) plotting. I'm kind of desperate to get away from R at this point, but reluctant to move to Python (not that I have anything against Python, but I would really like to add a high performance language to my toolkit than something inbetween).
- StefanKarpinski 12y agoIt depends on what you need. DataFrames [1] is a pretty good replacement for R's data frames. Distributions [2] is pretty amazing. Gadfly.jl [3] is a great ggplot-style plotting library that integrates nicely with IJulia [4]. If you have questions about specific things you need to do and want pointers, post on the julia-users list [5] and you should get some good answers. [1] http://harlanh.github.io/DataFrames.jl/ http://harlanh.github.io/DataFrames.jl/ [2] http://distributionsjl.readthedocs.org/en/latest/ http://distributionsjl.readthedocs.org/en/latest/ [3] https://github.com/dcjones/Gadfly.jl https://github.com/dcjones/Gadfly.jl [4] https://github.com/JuliaLang/IJulia.jl https://github.com/JuliaLang/IJulia.jl [5] https://groups.google.com/forum/#!forum/julia-users https://groups.google.com/forum/#!forum/julia-users
- zmmmmm 12y agoThanks!
- izyda 12y agoOut of curiosity, why are you so desperate to get away from R? Is it for the speed of a high performance language? As you mention, the vast selection of libraries (and the continual development of these libraries) make even the python module universe look small (in reference to statistical methods, statistical algorithms/machine learning, plotting). Further, not only are there a lot of libraries.. but many of them are bleeding edge written by the same people who originally invented the given algorithm. Most similar libraries in other languages (like Python) have incomplete ports of these libraries to them often not written by the same people. Not to mention, the documentation behind these algorithms is often excellent - besides the usual man files, there's "vignettes" (detailed instruction manual) as well as an entire journal that now has become a place to publish papers detailing the usage and implementation of many of these algorithms. So I'm curious, why leave?
- throwaway13qf85 12y agoI'm really excited by Julia. We use Matlab heavily in my team (as in, we probably have 300-600 Matlab instances running at any given time not counting the ones on personal workstations) and I'd love to use a language with similar support for numerical programming and linear algebra, but with better typing and functional programming support. Do you have any suggestions for slowly introducing Julia to the team?
- Bootvis 12y agoMay I ask what you're doing with all those instances? And to be extremely bold: what are you paying for all those licenses?
- irremediable 12y agoWhat's the deal with the lack of conditionals in comprehensions? Is there a good reason that the Julia devs didn't include that, or is it just something that's not been implemented yet? Edit: after a little searching, I found this. > Filters and guards don't mix with multidimensional comprehensions. For 1-d comprehensions, I'm not convinced that it's really worth the additional syntax. What's the case for making it part of the syntax instead of just using a filter function?
- omaranto 12y agoJulia's comprehensions are multidimensional array comprehensions so allowing filtering doesn't make much sense because the result needs to be rectangular and filtering can create arbitrary holes. For a one-dimensional array comprehension it does make sense to allow filtering and this can be easily expressed in Julia by making a coroutine that produces the values and collecting its output in an array. Multidimensional (here multi=2) array result: julia> [i+j for i=1:3, j=1:3] 3x3 Array{Int32,2}: 2 3 4 3 4 5 4 5 6 One dimensional array result, with filtering: julia> collect(@task for i=1:6; if i%3>0; produce(i); end; end) 4-element Array{Any,1}: 1 2 4 5 Notice that this last technique is more powerful than typical comprehensions, since it doesn't just add the possibility of filtering but arbitrary code to generate the elements.
- irremediable 12y agoThanks for the further info! I'd managed to figure out that it was because of multidimensional arrays (that snippet I quoted) but I didn't immediately see a nice way to achieve the same thing. And now, because you posted it, I do. I'll have to give Julia a go. :)
- SeanDav 12y agoIf I can ask a stupid question. Why Julia? It seems to me that if you are not going to be using Python, then why not use a language like Java?
- jey 12y agoHuh, what upside does Java have? Julia is specifically designed to be a great high-performance high-level language for scientific computing. See http://julialang.org/blog/2012/02/why-we-created-julia/ http://julialang.org/blog/2012/02/why-we-created-julia/
- pepon 12y agopublic class Answer { public static void main(String[] args) { System.out.println("That's why"); } }
- GFK_of_xmaspast 12y agoA lot of people doing scientific programming are not, in many senses of the word, 'programmers', and java doesn't really fit in the kinds of workflow they want. (That's not a condemnation, it's just the way it is, see also the ghosts of fortran 77)
- xioxox 12y agoI was interested in Julia until I discovered that it doesn't allow useful things like object-oriented inheritance (unless you go down some complex metaprogramming route). Multiple dispatch is indeed cool, but for some types of systems modelling with inheritance and classes is a great or the best approach (e.g. GUI widget libraries). I thought about how you might wrap something like Qt, gave up, and decided to continue with lovely Python (and its lovely 0 based indexes).
- ihnorton 12y agoSingle inheritance is possible and used extensively in Julia. Multiple inheritance is not (currently) supported, and there are a few places where it would be useful, but it is surprising that this would be a show stopper.
- xioxox 12y agoI'm not sure it's the single inheritance people from other languages might understand. Perhaps I'm misunderstanding things as I've hardly used the languages, but there are links like http://thenewphalls.wordpress.com/2014/03/06/understanding-object-oriented-programming-in-julia-inheritance-part-2/ http://thenewphalls.wordpress.com/2014/03/06/understanding-o... and http://grollchristian.wordpress.com/2014/01/22/julia-inheriting-behavior/ http://grollchristian.wordpress.com/2014/01/22/julia-inherit... and https://github.com/JuliaLang/julia/issues/4935 https://github.com/JuliaLang/julia/issues/4935
- ihnorton 12y agoSure, but that is a different thing than "not object-oriented inheritance". Designing with Julia's types and multiple-dispatch is different, but there are some nice patterns emerging. That said, Julia is still developing. The kinds of people who are interested in Julia right now are probably different from the people who we hope to attract and be broadly useful for in 2-5 years. But feedback now is important so the language and ecosystem can get there!
- SandB0x 12y agoHmm, I was hoping for some impressions of using Julia for numerical computing. The mechanics of list comprehensions and uppercasing some text seem a little tangential.
- thinkpad20 12y agoThat's an important part of Julia, but it's also important to talk about the language as a language. One of nice things about Julia is that it has things to talk about other than its numerical computing capabilities :) Those are fine and dandy, but as a non-numerical-computer, I find lots to like about Julia that has nothing to do with its ability to multiply matrices.
- ihaveqvestion 12y agoPeople who are using Julia or similar tools to do "scientific computing, machine learning, data mining, large-scale linear algebra, distributed and parallel computing" - what sort of problems are you solving? How did you end up doing this sort of work?
- hderms 12y agoJulia looks like a wonderful mix of Ruby, Python and ML (or something). I'm really eager to see this adopted by more people.
- matheusbn 12y agoAt the beginning of this article: "I spent most of last night programming in Julia and I've got some thoughts on my first impressions. TL;DR: It's like Python with less OOP, more FP and heavier typing. Also, it's awesome." -------------------------------- Then I clicked on the site's about: "Welcome to Eyeball Trees. My name is Stephen Malone and I cannot be trusted." I'm really confused!
- thinkpad20 12y agoI've been following Julia for a while now, not really using it, but playing with it a bit and keeping up with it. I think it's very promising and I really look forward to seeing it fledged out more. It's a very small nitpick, but I wish Julia had a postfix function application syntax. It would be nice to be able to say `foo = 'hello'.reverse` and have it be syntactic sugar for `foo = reverse(hello)`. Or some other operator since `.` is in use. This reads nicer for long function chains, and especially when a function modifies its argument, it's nice to have that argument come first, which gives an OO-impression. E.g. for me this: app = make_app(options) app.route("/", _ -> "hello, world!"), app.route("/submit", POST, req -> "hello, $(req.params["name"])!") app.start(3000) than this: app = make_app(options) route(app, "/", _ -> "hello, world!"), route(app, "/submit", POST, req -> "hello, $(req.params["name"])!") start(app, 3000)
- idunning 12y agoThere is this, which is similar but not quite the same: julia> "hello" |> reverse |> uppercase "OLLEH"
- doctoboggan 12y agoI too am intrigued by julia based off of my brief interactions with it. My only issue is the lack of namespaces. Is there a good reason why they aren't included?
- thinkpad20 12y agoThey are: http://docs.julialang.org/en/latest/manual/modules/ http://docs.julialang.org/en/latest/manual/modules/ Or is that not what you were referring to?