In as few lines as possible describe why you love julia

No need for root in Android, just follow this great post.

1 Like

Even faster

using SortingAlgorithms
@time sort!(rand(Float64, 10000000), alg=RadixSort)

Try the above. It’s faster.

2 Likes

Faster, I suspect

using SortingAlgorithms
@time sort!(rand(Float64, 100_000_000), alg=RadixSort)
1 Like

Because Julia people don’t quit(); the exit() gracefully.

4 Likes

Yes, this is ~20% faster and nice to know about that package!
However, it seems more unstable on my cellphone: sometimes the process aborts saying “Killed” or it can even abort the Julia REPL.

That’s what happens when you run out of memory on Linux.

2 Likes

radixsort does use double the memory.

3 Likes

Try this and MATLAB will not be faster any more. Future implementations of other algorithms into ThreadsX can get even faster. The Multithreading hero, aka @tkf, may give us more insights.

using ThreadsX
julia> @time ThreadsX.sort!(rand(Float64, 100_000_000));
  3.376360 seconds (4.29 M allocations: 1.973 GiB)

MATLAB (R2020a) for reference (multithreaded by default):

tic
sort(rand(100000000,1));
toc
Elapsed time is 3.731379 seconds.

I wish, in some way, all allocating functions would support given a pre allocated buffers on the function call.
To the least the in place flavors.
It means the user will be able to create a non allocating paradigm (Pre allocating all at the beginning of the program and from there just recycling the buffers).
It will probably also help the GC, right?

Maybe something to think about for Julia 2.0.
It can become very important in production.

4 Likes

Tagging @tro3 and @stillyslalom:

julia> using Unitful, Unitful.DefaultSymbols

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

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

Even better with some syntactical sugar

julia> using Unitful, Unitful.DefaultSymbols

julia> 800mV/53.55μA |> kΩ
14.939309056956116 kΩ
7 Likes

Yes, radix sort is great. So let’s parallelize it :slight_smile:

julia> using SortingAlgorithms, ThreadsX, ParallelRadixSort

julia> x = rand(Float64, 100_000_000);

julia> @time sort(x, alg = RadixSort);
  3.495047 seconds (18 allocations: 1.490 GiB)

julia> @time sort(x, alg = ThreadsX.QuickSort);
  2.001733 seconds (4.22 M allocations: 1.895 GiB, 5.03% gc time)

julia> @time sort(x, alg = ParallelMSDRadixSort);
  1.174623 seconds (134.32 k allocations: 1.496 GiB, 9.39% gc time)

julia> Threads.nthreads()
8

(All @times are not the first run since ParallelMSDRadixSort seems to have a large compilation overhead ATM.)

11 Likes

Julia, you are my only hope to escape from the heavily templated clutches of evil C++ Emperor with an awful syntax!

4 Likes

Julia: Code that actually composes

5 Likes

nice. I see the code is using MSD radix sort which only works if the data is “balanced” which happens to be the case for random data like this.

I would be interested in skewed data sorting with ParallelRadixsort!

1 Like