# In as few lines as possible describe why you love julia

**URL:** https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179
**Category:** New to Julia
**Created:** [January 10, 2020, 2:07am UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179 "2020-01-10T02:07:29Z")
**Posts on this page:** 20
**Page:** 5

<div class="post-metadata">

### Author: ![GregVernon](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/gregvernon/32/5611_2.png) [@GregVernon](https://discourse.julialang.org/u/GregVernon)
#### Post date: [January 28, 2020, 4:44am UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/83 "2020-01-28T04:44:11Z")

</div>

I was a convert when I rewrote a code that I had originally developed in Matlab. The code I’d written was intended to improve a commercial software I use at work that was painfully slow and completely manual. Thanks to writing the algorithm myself in Matlab I was able to improve the performance significantly and was automated. I rewrote the code in Julia and due to a number of things I was able to cut my LOC by ~20x, reduce required memory by orders of magnitude, and get a sizeable speedup.

[I posed the basics of the problem](https://discourse.julialang.org/t/multiply-many-matrices-by-many-vectors/18542) to the Julia discourse and received great feedback from the community.

Here’s a graphic I made for management shortly after my Julia rewrite. All told ~20,000 faster than the commercial code for a big-small (10k cells) problem and it made large problems (1M cells) tractable.

![image](https://global.discourse-cdn.com/julialang/original/3X/2/3/233c772817e8be1f507e00078c014471649a5f41.png)

---

<div class="post-metadata">

### Author: ![tro3](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tro3/32/12355_2.png) [@tro3](https://discourse.julialang.org/u/tro3)
#### Post date: [January 30, 2020, 2:53am UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/84 "2020-01-30T02:53:34Z")

</div>

Only discovered this today:

```julia
julia> mV = 1e-3
0.001

julia> uA = 1e-6
1.0e-6

julia> 800mV/53.55uA
14939.30905695612

```

(I assume that the “symbol-less” multiply takes a precedence I didn’t expect.) Too bad I don’t get the kOhm for free… 🙂

---

<div class="post-metadata">

### Author: ![stillyslalom](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stillyslalom/32/45687_2.png) [@stillyslalom](https://discourse.julialang.org/u/stillyslalom)
#### Post date: [January 30, 2020, 4:36am UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/85 "2020-01-30T04:36:31Z")

</div>

You can’t get it for free, but you can still get it pretty cheap:

```julia
julia> using Unitful, Unitful.DefaultSymbols

julia> 800mV/53.55μA
14.939309056956116 mV μA^-1

julia> uconvert(kΩ, ans)
14.939309056956116 kΩ

```

---

<div class="post-metadata">

### Author: ![RogerP](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rogerp/32/17496_2.png) [@RogerP](https://discourse.julialang.org/u/RogerP)
#### Post date: [January 31, 2020, 11:15am UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/86 "2020-01-31T11:15:42Z")

</div>

Jolly Useful Language I Approve

---

<div class="post-metadata">

### Author: ![RogerP](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rogerp/32/17496_2.png) [@RogerP](https://discourse.julialang.org/u/RogerP)
#### Post date: [February 2, 2020, 2:01pm UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/87 "2020-02-02T14:01:39Z")

</div>

Julia Unlocks Loads of Intelligent Algorithms

Julia Using Lisp Is Awesome

```julia
julia> using Looping, IncompleteLU, ApproxFun

```

sorry, once I get my teeth into something …

---

<div class="post-metadata">

### Author: ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)
#### Post date: [February 2, 2020, 6:15pm UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/88 "2020-02-02T18:15:45Z")

</div>

Someone once proposed “Julia Users Love Impressive Arithmetic” as a recursive retronym for Julia, and I’ve always rather liked that 😋

---

<div class="post-metadata">

### Author: ![klaff](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/klaff/32/7637_2.png) [@klaff](https://discourse.julialang.org/u/klaff)
#### Post date: [February 4, 2020, 2:01pm UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/89 "2020-02-04T14:01:47Z")

</div>

I like this thread better.

---

<div class="post-metadata">

### Author: ![RogerP](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rogerp/32/17496_2.png) [@RogerP](https://discourse.julialang.org/u/RogerP)
#### Post date: [February 5, 2020, 7:12pm UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/90 "2020-02-05T19:12:32Z")

</div>

@klaff but remember Julia (the) Ultimate Language Isn’t (an) Acronym

---

<div class="post-metadata">

### Author: ![mforets](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mforets/32/298_2.png) [@mforets](https://discourse.julialang.org/u/mforets)
#### Post date: [February 17, 2020, 2:22pm UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/91 "2020-02-17T14:22:00Z")

</div>

From their README:

```julia
If you want to use your custom convex objects, you can do so by extending the support function as:

import ConvexBodyProximityQueries.support
function ConvexBodyProximityQueries.support(obj::MyFancyShape, dir::SVector{N}) where {N}
  # do something
  return supporting_point::SVector{N}
end

```

Our _something_:

```julia
using LazySets

function ConvexBodyProximityQueries.support(obj::LazySet{N}, dir::SVector{D, N}) where {D, N}
    return LazySets.support_vector(dir, obj) |> SVector{D, N}
end

```

Congrats! 🎉 You have unlocked [Gilbert–Johnson–Keerthi distance algorithm](https://en.wikipedia.org/wiki/Gilbert%E2%80%93Johnson%E2%80%93Keerthi_distance_algorithm) for any lazy set 😛

```julia
# random test
X = rand(HPolygon)
Y = rand(VPolygon)
M = rand(2, 100)
Z = rand(Zonotope, dim=100) ⊕ ones(100)*20.
dir = @SVector(rand(2))
minimum_distance(X ⊕ Y, M*Z, dir)
520.1355965708728

```

---

<div class="post-metadata">

### Author: ![Ahmed\_Salih](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ahmed_salih/32/206579_2.png) [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)
#### Post date: [February 19, 2020, 11:30am UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/92 "2020-02-19T11:30:32Z")

</div>

Could you try to explain in a “basic way”, how it is possible for Julia code to be faster than C?

Maybe the question, I am asking, it self is wrong, but I always thought that Julia, at the end of things was running on some version of C?

Kind regards

---

<div class="post-metadata">

### Author: ![brownlight](https://avatars.discourse-cdn.com/v4/letter/b/9d8465/32.png) [@brownlight](https://discourse.julialang.org/u/brownlight)
#### Post date: [February 19, 2020, 12:16pm UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/93 "2020-02-19T12:16:51Z")

</div>

Few years back, I opted for Julia ( version 0.3.something at the time) for:

1. Super ease of coding for parallel processing.
2. Syntactic sweetness (above Python, IMHO).
3. Lots of built-in features/functions for math intensive code.
4. All three above with performance so close to C.

And it has been a delight to fathom Metaprogramming and Multiple Dispatch.

---

<div class="post-metadata">

### Author: ![StefanKarpinski](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stefankarpinski/32/24_2.png) [@StefanKarpinski](https://discourse.julialang.org/u/StefanKarpinski)
#### Post date: [February 19, 2020, 5:00pm UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/94 "2020-02-19T17:00:08Z")

</div>

Julia does whole program optimization by default, whereas C has boundaries at shared libraries. When you write generic code in C, you have to use void pointers, and it does not get specialized for different types; in Julia it does automatically with no special tricks required by the programmer. Julia is also better at code generation, so, for example C code typically uses a static array of coefficients to do Horner evaluation of polynomials, whereas in Julia the coefficients are inlined into the code that’s generated.

---

<div class="post-metadata">

### Author: ![stephenll](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stephenll/32/28751_2.png) [@stephenll](https://discourse.julialang.org/u/stephenll)
#### Post date: [February 19, 2020, 5:08pm UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/95 "2020-02-19T17:08:43Z")

</div>

Long time R & MATLAB user. Starting learning Julia about a month ago.

Rewrote c# financial simulation engine in Julia. c# is thousands of line long and requires expensive matrix/math/stats libraries. Julia is 100’s of lines of code. The Julia Code looks/writes similar to the c# because we don’t need to vectorize.

**Julia single threaded speed is about the same as the c# multi-threaded! Using the experimental threading scales almost 1 to 1. So now Julia Code is 4-5x times faster.**

Julia Code is faster, more maintainable, and a whole lot easier to experiment with thnt the c#. Now I am not reliant on the c# devs for research.

---

<div class="post-metadata">

### Author: ![fjfranco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fjfranco/32/6683_2.png) [@fjfranco](https://discourse.julialang.org/u/fjfranco)
#### Post date: [May 15, 2021, 7:01pm UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/96 "2021-05-15T19:01:56Z")

</div>

Open REPL, type this, press enter and go to make coffee.

@time sort!(rand(Float64, 10000000))

Probably, you hadn’t pulled back your chair before the instruction is executed.

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [May 15, 2021, 8:02pm UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/97 "2021-05-15T20:02:24Z")

</div>

@fjfranco, even if stretching it by one order of magnitude and running the Julia REPL on a cell phone it wasn’t enough time to get an espresso shot ready…

```julia
julia> @time sort!(rand(Float64, 100_000_000))
 12.751227 seconds (25 allocations: 762.959 MiB, 0.23% gc time)

```

---

<div class="post-metadata">

### Author: ![fjfranco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/fjfranco/32/6683_2.png) [@fjfranco](https://discourse.julialang.org/u/fjfranco)
#### Post date: [May 15, 2021, 9:17pm UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/98 "2021-05-15T21:17:30Z")

</div>

This is the first example I propose in Julia seminars to amaze my students!

Enjoy your expresso!

---

<div class="post-metadata">

### Author: ![rafael.guerra](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rafael.guerra/32/216610_2.png) [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)
#### Post date: [May 15, 2021, 11:25pm UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/99 "2021-05-15T23:25:49Z")

</div>

The beauty of Julia language, specially in OhMyREPL colors:

 ![Screenshot_20210516-020744](https://global.discourse-cdn.com/julialang/original/3X/c/6/c67b9423464ac7d66280fb14c60a1e90d217f926.png)

_ **NB:** snapshot of Android cellphone REPL.  
Post edited because of censorship._

---

<div class="post-metadata">

### Author: ![RoyiAvital](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/royiavital/32/571_2.png) [@RoyiAvital](https://discourse.julialang.org/u/RoyiAvital)
#### Post date: [May 16, 2021, 8:13am UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/100 "2021-05-16T08:13:56Z")

</div>

Have you tried it in other languages? Could you explain what’s your point in this example?

It seems to be fast in any language with an efficient `sort()` and `rand()` functions.  
For example, MATLAB (`R2021a`):

```matlab
>> tic; sort(rand(1e7, 1)); toc;
Elapsed time is 0.223402 seconds.

```

Python (`3.9.4` + `MKL`):

```python
%timeit np.sort(np.random.rand(10_000_000))
811 ms ± 3.89 ms per loop (mean ± std. dev. of 7 runs, 1 loop each)

```

For reference, this is Julia (`1.6.1`) on my machine:

```julia
julia> @time sort!(rand(Float64, 10_000_000));
  0.733050 seconds (2 allocations: 76.294 MiB, 9.77% gc time)

```

It doesn’t seem Julia is exceptionally fast in this example (Even though it has the advantage of working in place). I find Julia having in place `sort()` to be a nice advantage. But that’s hardly the bottleneck here.

Is `sort()` written in Julia? Was that your point? Having the `sort()` function written in a dynamic language and be fast (Same scale) as `c`? If so, it is indeed impressive.

---

<div class="post-metadata">

### Author: ![CameronBieganek](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cameronbieganek/32/6915_2.png) [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)
#### Post date: [May 18, 2021, 2:31pm UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/101 "2021-05-18T14:31:14Z")

</div>

> [@RoyiAvital](#):
>
> Could you explain what’s your point in this example?

Sometimes I’m just amazed at how fast computers can calculate things… 🙂

---

<div class="post-metadata">

### Author: ![aramirezreyes](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aramirezreyes/32/42573_2.png) [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)
#### Post date: [May 18, 2021, 4:10pm UTC](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179/102 "2021-05-18T16:10:11Z")

</div>

What is this? Do you have a link? Does it work with android? Do I need to be root?

[Previous page](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179.md?page=4)

[Next page](https://discourse.julialang.org/t/in-as-few-lines-as-possible-describe-why-you-love-julia/33179.md?page=6)
