4 ms·
If you need speed wouldn't the ability to write as a C extension beat using Julia?
by gregimba 13y ago
If you need speed wouldn't the ability to write as a C extension beat using Julia?
- odonnellryan 13y agoI think the point is the fun of the language. See here: http://julialang.org/ http://julialang.org/ and scroll down a bit for the speed comparison.
- nnq 13y agoWow, looking at those benchmarks it amazes me that Mathematica is so much faster than Matlab and Octave! I used to recommend Mathematica to anyone wishing to "play around with math" and "get a feel for it", due to the user friendly interface and 'manipulate' function that allows you to pop a few sliders for realtime manipulation of parameters in functions and instant visual feedback in one line of code, but always thought of it as either a "toy" or a "learning tool", compared to Matlab that is used by "serious engineers" (mind it, I like neither, I'm a Python and C person, but I'm also closer to what some would consider a "software engineer" and definitely not a mathematician or scientist).
- dagw 13y agoThere are really two reasons that Mathematica isn't taken seriously by engineers. The first is that Mathematica started life as a symbolic math package while engineers need numeric math. Now mathematica has done a lot over the past few release to catch up on the numeric side, but the notion that it is just for symbolic math lingers. The second is the language itself. Matlab is a procedural language heavily inspired by Fortran. Mathematica of the other hand as a largely functional language that takes several design cues from Lisp. Historically most engineers came from a Fortran rather than a Lisp background and most engineering programming is still taught in a "Fortran-inspired" way, so the Matlab language is simply more comfortable for most engineers to think and work in.
- carlob 13y agoTo be honest, I've given a quick look at the implementation in Mathematica, and I think one could do much better. The code is mostly wrapped in Compile statements and is very procedural in style. As a quick test I compared their quicksort with the built in Sort obtaining results about 30 times faster than theirs.
- ihnorton 13y agoWriting performant extensions for (C)Python requires knowing both C and the CPython API. In Julia it is easy to call C shared library functions directly with no overhead (similar to PyPy with CFFI).
- zaphar 13y agoJulia makes it pretty easy to write it in C if you want as well: http://docs.julialang.org/en/release-0.2/stdlib/base/#c-interface http://docs.julialang.org/en/release-0.2/stdlib/base/#c-inte... So that doesn't really give python a leg up over julia.
- pekk 13y agoIf I am going to write it in C then what in the world am I using Julia for?
- idunning 13y agoExactly - the C interop is used almost exclusively for connecting to existing libraries.
- ermintrude 13y agoCan you also call C++ libraries directly from Julia?
- 3JPLW 13y agoName mangling, as always, is a mess. If they export extern "C" headers, then of course there's no trouble. There's work on interfacing with the C++ ABI, though. See Cpp.jl[0] and Clang.jl (whose C++ support is still a WIP)[1]. [0]. https://github.com/timholy/Cpp.jl https://github.com/timholy/Cpp.jl [1]. https://github.com/ihnorton/Clang.jl/issues/20 https://github.com/ihnorton/Clang.jl/issues/20
- dagw 13y agoData IO, formatting, pre and post processing and presentation. My standard approach is to use python to read in all my data, parse it, format it and beat it into the shape I want. Then, if I need the performance, I pass the data to a highly tuned C function for slowest number crunching parts. Then I take the data back from C and parse it, format it, summarize it and write it out to the file formats I want using python. C may be faster for number crunching, but python is much nicer for data handling, and there the performance difference is negligible.
- ajtulloch 13y agoFor what it's worth, a quickly done C++11 implementation is <1.5x speedup over Julia. https://gist.github.com/ajtulloch/9499872 https://gist.github.com/ajtulloch/9499872