Huh, I didn’t know Julia had that feature. Personally, I wouldn’t find it very useful, since I’ve never wanted to hand-optimize generated assembly code. Besides, what would you do once you know what assembly is being generated? I guess you could use it to refactor your Julia code to run faster, but you can’t really tell what changes will make the assembly code better.
Personally, I find the easy FFI a lot more interesting, since it means you can hook into existing C libraries or into C code you’ve written yourself. For instance, I’m a contributor to a Julia audio library (https://github.com/ssfrr/AudioIO.jl), which uses the PortAudio and libsndfile libraries. Julia’s FFI means we don’t have to write a lot of boilerplate C code just to interface with the Julia runtime.
I really like this guy’s writing style, but I doubt that my interests will align with his. I’ve never needed that kind of raw compute power - the JVM or CLR has always been good enough. Regardless, I could see this being a good replacement for R, if the statistician community were to accept it.
Fortunately with Julia, there are a lot more reasons to like the language than just raw performance. Having an FFI that doesn’t give the FFI programmer a headache is pretty nice. Also, it has a good type system, homoiconicity, and all those other language features that the author doesn’t really care about.
This is also one of the things I like a lot about CMUCL and SBCL:
This is SBCL 220.127.116.11.debian, an implementation of ANSI Common Lisp.
* (defun f (x) (if (< x 2) 1 (+ (f (- x 1)) (f (- x 2)))))
* (f 8)
* (disassemble #'f)
; disassembly for F
; 0AB4E42E: 8B55F8 MOV EDX, [EBP-8] ; no-arg-parsing entry point
; 31: BF08000000 MOV EDI, 8
; 36: E8461F4BF6 CALL #x1000381 ; GENERIC-<
; 3B: 7C72 JL L5
; 3D: 8B55F8 MOV EDX, [EBP-8]
; 40: BF04000000 MOV EDI, 4
; 45: E8811D4BF6 CALL #x10001CB ; GENERIC--
; 4A: 7302 JNB L0
; 4C: 8BE3 MOV ESP, EBX
; 4E: L0: 8D5C24F8 LEA EBX, [ESP-8]
; 52: 83EC0C SUB ESP, 12
; 55: 8B05F8E3B40A MOV EAX, [#xAB4E3F8] ; #<FDEFINITION object for F>
; 5B: B904000000 MOV ECX, 4
; 60: 892B MOV [EBX], EBP
; 62: 8BEB MOV EBP, EBX
; 64: FF5005 CALL DWORD PTR [EAX+5]
; 67: 7302 JNB L1
; 69: 8BE3 MOV ESP, EBX
; 6B: L1: 8955FC MOV [EBP-4], EDX
I’ve often found it useful for answering “Why are my Lisp functions so slow?”
Is there a good web framework for Julia? I’d be interested in trying it out.