I am exploring using Julia as a general purpose scientific computing language (as opposed to python), but it's startup time is pretty sluggish.
Is there any way of speeding this up?
$ time python -c 'print "Hello"'
Hello
real 0m0.030s
user 0m0.018s
sys 0m0.010s
$ time julia -e 'println("Hello")'
Hello
real 0m4.614s
user 0m4.644s
sys 0m0.116s
ADDENDUM: Here is a quote from one of the Julia authors last year. Was there some difficulty with this strategy?
Most of Julia is written in itself, then parsed, type-inferred and jitted, so bootstrapping the entire system from scratch takes some 15-20 seconds. To make it faster, we have a staged system where we parse, type-infer, and then cache a serialized version of the type-inferred AST in the file sys.ji. This file is then loaded and used to run the system when you run julia. No LLVM code or machine code is cached in sys.ji, however, so all the LLVM jitting still needs to be done every time julia starts up, which therefore takes about 2 seconds.
This 2-second startup delay is quite annoying and we have a plan for fixing it. The basic plan is to be able to compile whole Julia programs to binaries: either executables that can be run or .so/.dylib shared libraries that can be called from other programs as though they were simply shared C libraries. The startup time for a binary will be like any other C program, so the 2-second startup delay will vanish.
Unfortunately Julia currently uses a lot of time to start, so it is almost impossible to use it in a bash script for really small problems. You will probably get a result that favors julia more with a complicated example that uses loops to do things multiple times, but with 2-4 second head start it requires a large problem to have enough time catch up. If the startup time is the most important for your scientific computing, Julia isn't ready yet.
An equally unfair comparison is to look at computing fibonacci numbers using the stupid recursive formula. It gets much much worse if you go above 26. Also notice how compact the Julia version of the code is.
As you asked for a way to speed up the problem; here it is:
The branch I mentioned in the comment has now been merged and julia is more optimized for startup (and doing nothing), than ever.
This is now available in the nightly builds, and will be included in the next 0.3 release.