5 ms·
Apart from the library ecosystem, what attracts you to Julia?
by continuational 8y ago
Apart from the library ecosystem, what attracts you to Julia?
- enitihas 8y agoRaw speed. Although julia has several nice features (multiple dynamic dispatch, macros), the raw speed obtained by annotating code with types is mind blowing. You can for the most part write like python, then annotate the slowest parts with types. It works really well.
- ChrisRackauckas 8y agoYou don't need to annotate types to get the speed.
- stabbles 8y agoYou don't even need to annotate things with types! > square(x) = x * x > @code_typed square(2.0) CodeInfo( 1 1 ─ %1 = Base.mul_float(%%x, %%x)::Float64 └── return %1 ) => Float64 > @code_typed square(2) CodeInfo( 1 1 ─ %1 = Base.mul_int(%%x, %%x)::Int64 └── return %1 ) => Int64 Functions specialize automatically to the arguments you pass in.
- ChrisFoster 8y agoOr, to see what's really going on at a low level you have immediate access to the native assembly from the REPL: julia> square(x) = x^2 square (generic function with 1 method) julia> @code_native square(1) .text Filename: REPL[3] pushq %rbp movq %rsp, %rbp Source line: 1 imulq %rdi, %rdi movq %rdi, %rax popq %rbp retq julia> @code_native square(1.0) .text Filename: REPL[3] pushq %rbp movq %rsp, %rbp Source line: 1 mulsd %xmm0, %xmm0 popq %rbp retq
- DNF2 8y agoYou don't need to annotate function definitions with types, but you should actually annotate your composite type definitions with concrete (parametric) types for each field.
- oxinabox 8y agoSyntax, semantics (multiple dispatch, type system), and community (so many clever people working together sharing expertise)
- rogerluo 8y agoActually, sometimes you feel its ecosystem does not attract you since this is really a new language, however, as a package developer, when we decide to use Julia or C++ to finish a performance sensitive simulator: https://github.com/QuantumBFS/Yao.jl https://github.com/QuantumBFS/Yao.jl we choose Julia, just because we only have two people and we still want something fast and easy to use in 3 month (since it is dynamic). Another thing is the multiple dispatch feature which is really natural to scientific projects (probably even some other area), cannot talk about much details, but just personal experience.
- ChrisRackauckas 8y agoYao.jl is a fantastic project and I hope to keep following it in the future. Maybe we can build differential equation solver algorithms which utilize quantum algorithms :)
- rogerluo 8y agoActually, since we are planning to integrate QASM and eQASM (a new kind of assembly from Delft), if you can use Yao.jl to run a quantum algorithm for solving differential equations (there has been several already), you will be able to run it on some real hardware. Still working on more features, and we do need more feedback to help us make this better, please feel free to give us any comments in the issue :)
- ChrisRackauckas 8y agoCool, I'm not familiar with quantum at all but I'll start looking into it. It will definitely be something we add to DifferentialEquations.jl common interface next year. I'll see about getting a Google Summer of Code project on this.
- sgt101 8y agoThe type system, which really encourages development of safe, reusable code. Also the type system can be a useful reusable solver. I strongly prefer the dependency management system to python's efforts. I like the strong arithmetic precision management facilities. Dynamic programming is interesting, but I'm not sure that its great for collaboration.
- ChrisFoster 8y agoDependency management for packages just got hugely better with the release of Pkg3 (now simply Pkg) as part of 0.7 / 1.0.
- sgt101 8y agoyes - 0.7 and the rigorous and (at a glance) hard to break system were a big thing for me; I've spent so many hours trying to make code tree A compile with code tree B in so many different languages in the past...
- sgt101 8y agoA few days later : ] is great, love it... just a shame so many major packages are broken!
- rrock 8y agoThe language design. A great deal of care went into making a language that is both expressive and performant. That’s a great combo for scientific work— or any work, for that matter.