# Julia programs now shown on benchmarks game website

**URL:** https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722
**Category:** Community
**Tags:** announcement
**Created:** [November 19, 2018, 5:44pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722 "2018-11-19T17:44:02Z")
**Posts on this page:** 20
**Page:** 1

<div class="post-metadata">

### Author: ![igouy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/igouy/32/8524_2.png) [@igouy](https://discourse.julialang.org/u/igouy)
#### Post date: [November 19, 2018, 5:44pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/1 "2018-11-19T17:44:02Z")

</div>

Julia programs (currently just those from [BaseBenchmarks.jl](https://github.com/JuliaCI/BaseBenchmarks.jl/tree/master/src/shootout)) are now shown on the [benchmarks game](https://benchmarksgame-team.pages.debian.net/benchmarksgame/) website.

Everyone is welcome to contribute improved programs to the project, following these instructions —

> **[CONTRIBUTING.md · master · The Computer Language Benchmarks Game /...](https://salsa.debian.org/benchmarksgame-team/benchmarksgame/blob/master/CONTRIBUTING.md)**
>
> Website that shows toy-program performance measurements for ~24 language implementations.

---

<div class="post-metadata">

### Author: ![DoktorMike](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/doktormike/32/2736_2.png) [@DoktorMike](https://discourse.julialang.org/u/DoktorMike)
#### Post date: [November 19, 2018, 7:49pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/2 "2018-11-19T19:49:37Z")

</div>

That’s really cool. But what’s up with the k-Nucleotide problem [k-nucleotide (Benchmarks Game)](https://benchmarksgame-team.pages.debian.net/benchmarksgame/performance/knucleotide.html) ? Julia is much slower than python3 here. I didn’t investigate further it just struck me as odd. 😊

---

<div class="post-metadata">

### Author: ![Mason](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mason/32/2423_2.png) [@Mason](https://discourse.julialang.org/u/Mason)
#### Post date: [November 19, 2018, 8:05pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/3 "2018-11-19T20:05:11Z")

</div>

I’m surprised Julia is getting smoked so badly by Java in so many benchmarks.

I remember people saying that they tried not to squeeze out all the performance they could from Julia in the benchmarks repository so they could compare naïve idiomatic Julia code to naïve idiomatic code in other languages. Is this what’s going on here?

---

<div class="post-metadata">

### Author: ![hckr](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/hckr/32/4836_2.png) [@hckr](https://discourse.julialang.org/u/hckr)
#### Post date: [November 19, 2018, 8:26pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/4 "2018-11-19T20:26:46Z")

</div>

Julia does not make use of multithreading/multiprocessing while implementations in other languages do. Is there a specific reason for that?

---

<div class="post-metadata">

### Author: ![foobar\_lv2](https://avatars.discourse-cdn.com/v4/letter/f/ee59a6/32.png) [@foobar\_lv2](https://discourse.julialang.org/u/foobar_lv2)
#### Post date: [November 19, 2018, 8:27pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/5 "2018-11-19T20:27:57Z")

</div>

K-nucleotide:

```julia
function count(data::AbstractString, n::Int)
    counts = Dict{AbstractString, Int}()
...

```

Abstractly typed container: Big no, almost never. Should be

```julia
function count(data::T, n::Int) where {T<:AbstractString}
    counts = Dict{T, Int}()
...

```

Binary tree:

```julia
abstract type BTree end

mutable struct Empty <: BTree
end

mutable struct Node <: BTree
    left::BTree
    right::BTree
end

```

We know the type hierarchy at compile time:

```julia
mutable struct Node 
    left::Union{Nothing, Node}
    right::Union{Nothing, Node}
end

```

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [November 19, 2018, 8:37pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/6 "2018-11-19T20:37:01Z")

</div>

FWIW, there hasn’t been much time making these fast, they have just been used to regress test the performance of julia itself.

---

<div class="post-metadata">

### Author: ![Seif\_Shebl](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@Seif\_Shebl](https://discourse.julialang.org/u/Seif_Shebl)
#### Post date: [November 19, 2018, 8:43pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/7 "2018-11-19T20:43:18Z")

</div>

The timings for Julia are totally unfair, no optimization options are passed or bounds-checking switches whereas other languages enable all possible optimizations. As an example, the nbody program on my computer times:

```
4.44 sec : Julia (9% off the fastest language)
4.05 sec : ifort

```

on the website, that’s another story. Look at this:

```julia
MAKE:
/opt/src/intel/bin/ifort -O3 -ipo -static -xHost nbody.ifc-6.f90 -o nbody.ifc-6.ifc_run
rm nbody.ifc-6.f90

```

vs.

```julia
COMMAND LINE:
/opt/src/julia-1.0.2/bin/julia -- nbody.julia 50000000

```

Can we fix this?

---

<div class="post-metadata">

### Author: ![pkofod](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/pkofod/32/2179_2.png) [@pkofod](https://discourse.julialang.org/u/pkofod)
#### Post date: [November 19, 2018, 9:05pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/8 "2018-11-19T21:05:00Z")

</div>

> [@kristoffer.carlsson](#):
>
> FWIW, there hasn’t been much time making these fast, they have just been used to regress test the performance of julia itself.

Knowing Julia community, these ranking might change soon 😉

---

<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: [November 19, 2018, 9:10pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/9 "2018-11-19T21:10:34Z")

</div>

> [@Mason](#):
>
> I’m surprised Julia is getting smoked so badly by Java in so many benchmarks.

The Java implementations of these benchmarks have been optimized to death. The Julia versions are mostly naive high-level versions. There’s a lot of room for improvement there.

---

<div class="post-metadata">

### Author: ![Sukera](https://avatars.discourse-cdn.com/v4/letter/s/ce7236/32.png) [@Sukera](https://discourse.julialang.org/u/Sukera)
#### Post date: [November 19, 2018, 9:16pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/10 "2018-11-19T21:16:33Z")

</div>

While java programs have been looked over more often, we shouldn’t forget the constraints of each individual program - they’ve all got certain restrictions, e.g. not implementing a strictly better algorithm.

Admittedly, I’ve only looked at the Julia code and not the java code - but I think Julia can still improve by a large amount 😂

---

<div class="post-metadata">

### Author: ![Orbots](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/orbots/32/3392_2.png) [@Orbots](https://discourse.julialang.org/u/Orbots)
#### Post date: [November 19, 2018, 9:38pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/11 "2018-11-19T21:38:30Z")

</div>

structs in Binary tree don’t need to be mutable. Just changing that improves perf by 30%. Read only data typically leads to better cache performance.

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [November 19, 2018, 10:24pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/12 "2018-11-19T22:24:23Z")

</div>

I started something here if people are interested in contributing:

> **[GitHub - JuliaPerf/BenchmarksGame.jl](https://github.com/JuliaPerf/BenchmarksGame.jl)**
>
> Contribute to JuliaPerf/BenchmarksGame.jl development by creating an account on GitHub.

Not everything works yet.

---

<div class="post-metadata">

### Author: ![igouy](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/igouy/32/8524_2.png) [@igouy](https://discourse.julialang.org/u/igouy)
#### Post date: [November 19, 2018, 10:29pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/13 "2018-11-19T22:29:45Z")

</div>

Of course.

Also, more than one program can be shown for the same task, so — a simple Julia program, a low-memory Julia program, a fastest elapsed time Julia program, a low cpu time Julia program.

For example, I think the Chapel programs are aimed at showing how well simple “readable” Chapel programs perform, rather than doing low-level stuff.

---

<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: [November 19, 2018, 10:40pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/14 "2018-11-19T22:40:27Z")

</div>

Yes, I think that the Julia versions should aim for 1-2x C with decent readability. That’s always been our sweet spot; eeking out the last drop of performance at the cost of readability is rarely worth it.

---

<div class="post-metadata">

### Author: ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)
#### Post date: [November 19, 2018, 11:07pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/15 "2018-11-19T23:07:13Z")

</div>

In my case, I managed to have a SGP4 propagator with similar performance of that of FORTRAN 77 (10% slower) with 10000000x more readability 😅

---

<div class="post-metadata">

### Author: ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)
#### Post date: [November 19, 2018, 11:15pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/16 "2018-11-19T23:15:20Z")

</div>

If we want to improve the performance, should we PR to your repo? Moreover, can we use packages like StaticArrays?

---

<div class="post-metadata">

### Author: ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)
#### Post date: [November 19, 2018, 11:28pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/17 "2018-11-19T23:28:57Z")

</div>

I think we should avoid using packages. PRs accepted. The testing and benchmarking script needs love as well. I’ll get to it in a while though if no one else beats me to it 🙂

---

<div class="post-metadata">

### Author: ![Ronis\_BR](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ronis_br/32/50999_2.png) [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)
#### Post date: [November 19, 2018, 11:31pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/18 "2018-11-19T23:31:24Z")

</div>

I think I can play with this in my spare time. Furthermore, this seems a very good reason to merge StaticArrays into core language don’t you think 😅

---

<div class="post-metadata">

### Author: ![chakravala](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chakravala/32/6832_2.png) [@chakravala](https://discourse.julialang.org/u/chakravala)
#### Post date: [November 20, 2018, 1:59am UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/19 "2018-11-20T01:59:10Z")

</div>

> [@Orbots](#):
>
> structs in Binary tree don’t need to be mutable. Just changing that improves perf by 30%. Read only data typically leads to better cache performance.

Another way is to represent collections of binary trees as matrices, my package has all the operations needed to operate on collections of binary trees as matrix operations, nested objects / fields are not required for trees.

> **[GitHub - chakravala/Dendriform.jl: Dendriform di-algebra algorithms to...](https://github.com/chakravala/Dendriform.jl)**
>
> Dendriform di-algebra algorithms to compute using Loday's arithmetic on groves of planar binary trees - GitHub - chakravala/Dendriform.jl: Dendriform di-algebra algorithms to compute using Loda...

Not that it should be used or the test, just saying that matrices can be used instead of nested objects, and I can do operations on entire collections of binary trees at once with a single matrix operation.

---

<div class="post-metadata">

### Author: ![Orbots](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/orbots/32/3392_2.png) [@Orbots](https://discourse.julialang.org/u/Orbots)
#### Post date: [November 20, 2018, 2:17am UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/20 "2018-11-20T02:17:05Z")

</div>

Each benchmark has a description for the game. The binary tree game is intended to be stress test of the default garbage collector for a language.  
Lucky for C/C++ they don’t have a default GC, so they get to pick the fastest memory pool they can find. Which would violate the rules for any other language.  
Anyways, with multithreading and a few performance tweaks the Julia implementation should be in the ballpark of a C/C++ implementation that uses malloc/free

> **[binary-trees description (Benchmarks Game)](https://benchmarksgame-team.pages.debian.net/benchmarksgame/description/binarytrees.html#binarytrees)**
>
> What the binary-trees benchmarks game programs should do.

[Next page](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722.md?page=2)
