A very short tour through the Julia community and how key features of the language interact to produce an expressive syntax that users like without sacrificing performance
1. compiler and community
Jiahao Chen
MIT Computer Science and Artificial Intelligence Laboratory
julialang.org
Alan EdelmanJeff Bezanson Stefan Karpinski Viral B. Shah
3. as of 2014-06-30
The world of
181 package-only developers
252 contributors to julia repo
3,906 stargazers
321 watchers
4. What’s the big deal about Julia ?
julialang.org/benchmarks
5. What’s the big deal about Julia ?
Julia isn’t designed for performance using all
means necessary.
“FFTW (FFTs) and BLAS libraries (matrix multiplication)
take ~100,000 lines [of code] to solve problems that can
be implemented in ~15 lines of (slow) code… It usually
isn’t worth it to get the last factor of two in speed”
!
- Steven Johnson, author of FFTW (emphases his)
6. What’s the big deal about Julia ?
Julia isn’t designed for performance using all
means necessary. Instead, performance comes
from designing a language that is easy for both
humans and compilers to understand.
!
Multimethods (multiple dispatch) is one of the key
mechanisms.
14. methods objects
Object-oriented programming with classes
What can I do with/to a thing?
top up
pay fare
lose
buy
top up
pay fare
lose
buy
pay fare
lose
buy
class-based OO
!
classes are more
fundamental
than methods
17. Multi-methods for linear algebra
What can I do with/to a thing?
find eigenvalues and eigenvectors
find singular values
find singular values and vectors
find eigenvalues
generic
function
objectsmethods
general matrix
symmetric tridiagonal matrix
bidiagonal matrix
Methods can take advantage of special matrix structures
eigvals
eigfact
svdvals
svdfact
Matrix
SymTridiagonal
Bidiagonal
18. So how does this help us with linear algebra?
Multi-method dispatch on special matrix types
19. So how does this help us with linear algebra?
Multi-method dispatch on special matrix types
20. So how does this help us with linear algebra?
Multi-method dispatch on special matrix types
stev!{T<:BlasFloat} calls sgestv
dgestv
cgestv
zgestv
and handles workspace
memory allocation
21. What’s the big deal about Julia ?
Julia isn’t designed for performance using all
means necessary. Instead, performance comes
from designing a language that is easy for both
humans and compilers to understand.
!
!
22. from the programmer’s point of view:
!
- dynamic language semantics: faster to prototype code
- dynamic types: compiler does not hinder experimentation
- multiple dispatch allows both methods for general
functionality and methods for specialized performance
- low-cost software abstractions allow code to retain
structure of mathematical abstractions
- metaprogramming (with macros) allows code generation:
takes software experimentation to the next level with less
lines of actual code
- flexible syntax, Unicode operators, great community…
24. from the compiler’s point of view:
!
- dynamic semantics with static analysis: when possible,
offload runtime checks to JIT compile stage
- multiple dispatch requires function signatures that expose
type information
- rich type system allows for detailed type inference
- inlining passes reduce abstraction cost
- automatic code specialization generates many performant
methods
- macros allow further fine-grained tradeoffs between
performance and correctness, e.g. @inbounds, @simd,
…