# 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:** 5

<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: [January 24, 2019, 7:49pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/82 "2019-01-24T19:49:19Z")

</div>

Hopefully, now that Julia 1.1.0 has landed, some more programs from [BenchmarksGame.jl](https://github.com/KristofferC/BenchmarksGame.jl) will make it to the benchmarks game website.

---

<div class="post-metadata">

### Author: ![ninjaaron](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ninjaaron/32/6392_2.png) [@ninjaaron](https://discourse.julialang.org/u/ninjaaron)
#### Post date: [January 25, 2019, 10:52am UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/83 "2019-01-25T10:52:32Z")

</div>

Doesn’t look like it.

---

<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: [January 25, 2019, 6:34pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/84 "2019-01-25T18:34:40Z")

</div>

I expect the program authors are busy doing other stuff, and will eventually contribute their programs to the benchmarks game.

---

<div class="post-metadata">

### Author: ![Olof\_Salberger](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/olof_salberger/32/4850_2.png) [@Olof\_Salberger](https://discourse.julialang.org/u/Olof_Salberger)
#### Post date: [May 17, 2019, 5:14pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/85 "2019-05-17T17:14:34Z")

</div>

Benchmarks game website added comparisons to Fortran and Chapel.

I wrote my own benchmark for reverse complement since it is currently the slowest up there, and managed to bring down memory use to competitive with the best from other languages. Haven’t submitted anything though.

> <https://github.com/saolof/languageshootout.jl/blob/master/reverse_complement.jl>

Still not fully optimized and mostly written for readability (hopefully). Feel free to suggest improvements.

---

<div class="post-metadata">

### Author: ![Juan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/juan/32/7657_2.png) [@Juan](https://discourse.julialang.org/u/Juan)
#### Post date: [May 18, 2019, 2:06am UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/86 "2019-05-18T02:06:36Z")

</div>

Unfortunatelly the benchmarks game site doesn’t update the results.

---

<div class="post-metadata">

### Author: ![Olof\_Salberger](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/olof_salberger/32/4850_2.png) [@Olof\_Salberger](https://discourse.julialang.org/u/Olof_Salberger)
#### Post date: [May 18, 2019, 8:32pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/87 "2019-05-18T20:32:15Z")

</div>

Made some further changes. Just submitted my benchmark as a PR on their repo. I don’t expect too much from it.

> **[Julia reverse-complement saolof (#128) · Issues · The Computer Language...](https://salsa.debian.org/benchmarksgame-team/benchmarksgame/-/issues/128)**
>
> build: N/A run: julia -O3 reverse\_complement\_submission.jl \< revcomp-input.txt Also have a github page for it over here, with more comments:

I think that having a decent showing on the benchmarks game is a relatively important thing to do from a PR perspective if we want to tell people that the language is fast. The language has been post-1.0 for almost a year now.

---

<div class="post-metadata">

### Author: ![Karajan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/karajan/32/8545_2.png) [@Karajan](https://discourse.julialang.org/u/Karajan)
#### Post date: [May 19, 2019, 4:57pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/88 "2019-05-19T16:57:08Z")

</div>

Nice!  
Your code looks, however, like you are not doing a [“read line-by-line”](https://benchmarksgame-team.pages.debian.net/benchmarksgame/description/revcomp.html#revcomp): `body = readuntil(instream,UInt8('>'))`? This is the part where I broke my neck trying to reach Kristoffers speeds, because you can’t really allocate memory for the whole string until you know how long it’s going to be.

I got down to maybe 40% of the current time, while Kristoffer & Crew are somewhere around 15% on my computer 😛

---

<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: [May 20, 2019, 7:45pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/89 "2019-05-20T19:45:04Z")

</div>

> [@Karajan](#):
>
> not doing a [“read line-by-line”](https://benchmarksgame-team.pages.debian.net/benchmarksgame/description/revcomp.html#revcomp)

Yeah.

---

<div class="post-metadata">

### Author: ![Olof\_Salberger](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/olof_salberger/32/4850_2.png) [@Olof\_Salberger](https://discourse.julialang.org/u/Olof_Salberger)
#### Post date: [May 20, 2019, 8:16pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/90 "2019-05-20T20:16:09Z")

</div>

Ugh. That’s an absolutely stupid way to read a big block of text into memory, or even to parse a formated stream.

Okay, that can still be made fast with BufferedStreams.jl at the cost of extra memory use. I’ll write a version based on that, and rewrite a basic implementation of InputStreams myself if I get complaints over dependencies. The Golang solution gets to use BufIO. Big question is whether or not you are allowed to use anchors.

---

<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: [May 20, 2019, 8:39pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/91 "2019-05-20T20:39:26Z")

</div>

I think your code is fine and the point is simply that it must work interactively: Whenever you get sent enough input that there is a newline, you need to process and flush output and are disallowed from waiting (blocking) for more input. It is not permissible to wait until EOF with the processing.

---

<div class="post-metadata">

### Author: ![dlakelan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlakelan/32/8491_2.png) [@dlakelan](https://discourse.julialang.org/u/dlakelan)
#### Post date: [June 3, 2019, 11:34am UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/92 "2019-06-03T11:34:06Z")

</div>

> [@Olof\_Salberger](#):
>
> Ugh. That’s an absolutely stupid way to read a big block of text into memory, or even to parse a formated stream

FASTA is one line per gene if I remember correctly, so each line here could be say 5-40KB and the whole file could be a couple of gigs, so you can’t just slurp the whole file into RAM, well these days you can but 20 years ago or more when the files were invented you couldn’t.

in any case it’s not reading 80 chars at a time

---

<div class="post-metadata">

### Author: ![Karajan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/karajan/32/8545_2.png) [@Karajan](https://discourse.julialang.org/u/Karajan)
#### Post date: [June 5, 2019, 6:48am UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/93 "2019-06-05T06:48:51Z")

</div>

> [@dlakelan](#):
>
> in any case it’s not reading 80 chars at a time

You are right, it’t [60 chars at a time](https://benchmarksgame-team.pages.debian.net/benchmarksgame/download/revcomp-input.txt) (from a 1GB file) 😉

And at least for this benchmark you pretty much _have_ to read it all into memory (look at the [memory use](https://benchmarksgame-team.pages.debian.net/benchmarksgame/performance/revcomp.html)), because you have to reverse the whole thing and you can’t really do that before you have read in the end.

---

<div class="post-metadata">

### Author: ![Olof\_Salberger](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/olof_salberger/32/4850_2.png) [@Olof\_Salberger](https://discourse.julialang.org/u/Olof_Salberger)
#### Post date: [August 19, 2019, 11:26pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/94 "2019-08-19T23:26:33Z")

</div>

Update: over the past few months, it looks like a number of people did some amazing work submitting benchmarks, and Julia now has a very respectable showing, ahead of Swift and Go:

 ![benchmarksgame](https://global.discourse-cdn.com/julialang/original/3X/4/e/4ee056f00ee06e7f9251176823c88dae0dd05bdd.png)

I also think that there’s still quite a bit of additional performance that can be squeezed out. But I think this is a great showing that will help steer more people towards the language.

---

<div class="post-metadata">

### Author: ![xiaodai](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/xiaodai/32/15937_2.png) [@xiaodai](https://discourse.julialang.org/u/xiaodai)
#### Post date: [August 20, 2019, 3:36am UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/95 "2019-08-20T03:36:11Z")

</div>

Kind of happy to see Pascal. One of my first languages

---

<div class="post-metadata">

### Author: ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)
#### Post date: [August 20, 2019, 10:09am UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/96 "2019-08-20T10:09:49Z")

</div>

[https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/fasta-julia-4.html](https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/fasta-julia-4.html)

The best time I get on MY decade old laptop is (i.e.NOT with 4 or 2 threads):

```plaintext
time ~/julia-1.1.0/bin/julia -O3 -- fasta.jl 25000000 >/dev/null

```

| real | 0m6,066s |
| --- | --- |
| user | 0m4,928s |
| sys | 0m0,232s |

While I regularly get under 5 sec (for “user”). I’m unable to get less than 5.1 sec. on julia-1.3.0-alpha, with whatever optimization level or number of threads.

At least I get slower with (for both below) export JULIA\_NUM\_THREADS=4

```julia
time ~/julia-1.1.0/bin/julia -O2 -- fasta.jl 25000000 >/dev/null

```

| real | 0m6,385s |
| --- | --- |
| user | 0m4,984s |
| sys | 0m0,212s |

```julia
time ~/julia-1.1.0/bin/julia -O3 -- fasta.jl 25000000 >/dev/null

```

| real | 0m6,479s |
| --- | --- |
| user | 0m5,008s |
| sys | 0m0,196s |

MY best on Julia-1.3.0-alpha (best combination, i.e. NOT -O3, nor more threads faster):

```julia
export JULIA_NUM_THREADS=1
time julia -O2 -- fasta.jl 25000000 >/dev/null

```

| real | 0m6,372s |
| --- | --- |
| user | 0m5,212s |
| sys | 0m0,164s |

Please consider these settings on your machines, and when submitting benchmarks if LOWER optimization levels (or older Julia versions) is faster; and if disabling threading, or what numbers of is fastest (this may say more about my Core Duo laptop, or threads has startup-overhead?). Best case startup for me is real 0m0,313s" on Julia-1.3.0-alpha, (can easily be “real 0m0,390s”), and 1.1 is just slightly slower at best “real 0m0,330s”, but I’ve seen “real 0m0,958s”.

Could it be that -O0 disables threads? On MY machine in the test below, 1 thread is better for -O3 (and -O0).

I found -O3 to be 46% SLOWER than -O0 on “real” (when both CONFIGURED for 4 threads); 42% slower with best settings for both (2,572s vs. 1,813s for “real” time; even worse on “user” time, then 61% slower 1,992s vs. 1,236s), this was all WHEN I was first testing (for below, not above test) using the shorter test file (not the longer one actually used in the benchmark to make it long-running, still useful to know how it affects speed):

```julia
export JULIA_NUM_THREADS=1
time ~/julia-1.3.0-alpha/bin/julia -O0 -- kn.jl 0 < ~/Downloads/knucleotide-input.txt 

```

| real | 0m1,813s |
| --- | --- |
| user | 0m1,296s |
| sys | 0m0,204s |

also got:

| real | 0m2,047s |
| --- | --- |
| user | 0m1,236s |
| sys | 0m0,272s |

```julia
export JULIA_NUM_THREADS=4
time ~/julia-1.3.0-alpha/bin/julia -O3 -- kn.jl 0 < ~/Downloads/knucleotide-input.txt

```

| real | 0m2,887s |
| --- | --- |
| user | 0m2,144s |
| sys | 0m0,188s |

```julia
export JULIA_NUM_THREADS=4
time ~/julia-1.3.0-alpha/bin/julia -O0 -- kn.jl 0 < ~/Downloads/knucleotide-input.txt 

```

| real | 0m2,010s |
| --- | --- |
| user | 0m1,392s |
| sys | 0m0,184s |

```julia
export JULIA_NUM_THREADS=1
time ~/julia-1.1.0/bin/julia -O3 -- kn.jl 0 < ~/Downloads/knucleotide-input.txt

```

| real | 0m2,572s |
| --- | --- |
| user | 0m2,048s |
| sys | 0m0,180s |

[As with here, I’m always going for lowest “user” and have seen lower “real”, but then “user” higher.]

```julia
time ~/julia-1.3.0-alpha/bin/julia -O3 -- kn.jl 0 < ~/Downloads/knucleotide-input.txt 

```

| real | 0m2,829s |
| --- | --- |
| user | 0m1,992s |
| sys | 0m0,196s |

```julia
time julia --compile=min -- kn.jl 0 < ~/Downloads/knucleotide-input.txt 

```

| real | 0m6,511s |
| --- | --- |
| user | 0m4,820s |
| sys | 0m0,232s |

> **[Julia vs Java - Which programs are fastest?](https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/julia.html)**
>
> Julia Java - Which programs have fastest performance?

---

<div class="post-metadata">

### Author: ![Karajan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/karajan/32/8545_2.png) [@Karajan](https://discourse.julialang.org/u/Karajan)
#### Post date: [August 20, 2019, 4:18pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/97 "2019-08-20T16:18:29Z")

</div>

> Update: over the past few months, it looks like a number of people did some amazing work submitting benchmarks, and Julia now has a very respectable showing, ahead of Swift and Go:

Yes, a bunch of the work has been done, mostly by the amazing @non-Jedi (currently 4/10 top Julia programs).

> I also think that there’s still quite a bit of additional performance that can be squeezed out.

Quite possibly, yes.

- pidigits: all GMP calls anyways, so not too much hope here
- revcomp: I’m currently trying to get a buffered version to be accepted. With 1.3 I’ll try to do some multithreading.
- fasta: 1.3 mulitthreading will help for sure
- nbody: … Adam is currently [fighting](https://discourse.julialang.org/t/relative-performance-discrepancy-across-cpus-even-with-cpu-target-set/27503) with this one, maybe some SIMD wizards can help out. Not sure how Rust manages to be this much faster on pure number crunching.
- knuc: maybe multithreading helps, maybe some more hacks regarding the hash function… not quite sure.
- binarytrees: [because Julia provides GC](https://benchmarksgame-team.pages.debian.net/benchmarksgame/description/binarytrees.html#binarytrees), there is not much that can be done here, I think
- With the other ones I’m not sure because I haven’t tried them. Many of the are quite fast already though.

---

<div class="post-metadata">

### Author: ![non-Jedi](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/non-jedi/32/3645_2.png) [@non-Jedi](https://discourse.julialang.org/u/non-Jedi)
#### Post date: [August 20, 2019, 4:48pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/98 "2019-08-20T16:48:15Z")

</div>

> [@Karajan](#):
>
> binarytrees: [because Julia provides GC](https://benchmarksgame-team.pages.debian.net/benchmarksgame/description/binarytrees.html#binarytrees), there is not much that can be done here, I think

I do wonder why this one runs so much slower multi-threaded than it does with multiple processes. Is there something to do with heap-allocating and garbage collection that’s inherently not amenable to multi-threaded environments? If we could use multi-threading instead of multiple processes, that would take a rather large chunk off the run time.

To expand on the list off the top of my head:

- regex-redux: could become faster once 1.3 lands with new threading runtime (and thread-safe regex) since execution time is dominated by a strictly non-parallelizable task that could be started on a single thread ahead of other work.
- mandelbrot: isn’t currently using all cpu cores effectively compared to other implementations. I haven’t identified why yet.
- revcomp: in addition to buffered read @Karajan is working on, this could also benefit from new threading runtime to start working on a specific sequence while still reading input. It also may be possible to speedup the reversal of each sequence using multi-threading if you divide it into “chunks” instead of just using a naive `Threads.@threads` looping over the array; this requires removing new-lines from the array being reversed–slightly different than @Karajan current fastest implementation.
- knuc: julia’s hashmap in general seems slower than some other implementations; not sure why. There’s an opportunity for better usage of cpu cores by implementing parallelism within the counting of each frame instead of around it.
- fasta: obvious opportunity to parallelize, but I haven’t taken the time to grok what the benchmark is actually doing yet.

---

<div class="post-metadata">

### Author: ![jebej](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jebej/32/1784_2.png) [@jebej](https://discourse.julialang.org/u/jebej)
#### Post date: [August 20, 2019, 5:03pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/99 "2019-08-20T17:03:32Z")

</div>

The one I don’t understand is nbody: it takes 3.2 sec on my computer to run, and on the website is says that the benchmark takes 22 sec. I don’t think my computer should be that much faster…

EDIT: The code here: [https://github.com/KristofferC/BenchmarksGame.jl/blob/master/nbody/nbody-fast.jl](https://github.com/KristofferC/BenchmarksGame.jl/blob/master/nbody/nbody-fast.jl) is even faster (and simpler to understand) at 2.8sec.

---

<div class="post-metadata">

### Author: ![Palli](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/palli/32/3380_2.png) [@Palli](https://discourse.julialang.org/u/Palli)
#### Post date: [August 20, 2019, 5:07pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/100 "2019-08-20T17:07:42Z")

</div>

Which benchmark? You probably made the same mistake I did, running one with a shorter test file. As I did for the second benchmark in my comment above.

---

<div class="post-metadata">

### Author: ![jebej](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jebej/32/1784_2.png) [@jebej](https://discourse.julialang.org/u/jebej)
#### Post date: [August 20, 2019, 5:17pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/101 "2019-08-20T17:17:30Z")

</div>

Here: [n-body Julia&nbsp;#3 program (Benchmarks Game)](https://benchmarksgame-team.pages.debian.net/benchmarksgame/program/nbody-julia-3.html)

I get the same output so I think I’m running the right thing.

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

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