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

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [January 9, 2019, 4:18pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/62 "2019-01-09T16:18:31Z")

</div>

> [@tomaklutfu](#):
>
> Please don’t implement your own custom [“arena”](http://www.stroustrup.com/bs_faq2.html#placement-delete) or “memory pool” or “free list” - they will not be accepted

Well, I’m not sure if that would actually apply, since it’s a 1:1 port from the leading C++ solution and there isn’t even any official memory pool implementation in Julia (and mostly doesn’t need to be?).  
My “memory pool” trick even ended up simpler than the C++ version that uses a dedicated memory pool library, so I’d find it pretty irritating if the solution wouldn’t get accepted 😉

---

<div class="post-metadata">

**Author:** ![tomaklutfu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tomaklutfu/32/2411_2.png) [@tomaklutfu](https://discourse.julialang.org/u/tomaklutfu)\
**Post date:** [January 9, 2019, 4:21pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/63 "2019-01-09T16:21:50Z")

</div>

> **[Improvement of binary-trees implementation in Go (#80) · Issues · The ...](https://salsa.debian.org/benchmarksgame-team/benchmarksgame/-/issues/80)**
>
> CONTRIBUTE SOURCE CODE Provide a helpful Title Small improvement over currently fastest binary-trees implementation...

> [Isaac Gouy @igouy-guest](https://salsa.debian.org/igouy-guest)commented [1 week ago](https://salsa.debian.org/benchmarksgame-team/benchmarksgame/issues/80#note_57214)
> 
> It is unfortunate that Go does not provide a pool/arena/… and obviously `storozhukBM/arena` is exactly what I ask people not to do.
> 
> Go does provide GC.
> 
> Sorry.

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [January 9, 2019, 4:30pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/64 "2019-01-09T16:30:26Z")

</div>

That’s a pretty weird attitude, considering that the “pool” basically comes with no extra effort and is even less verbose than in a language that doesn’t have a GC and hence would need much better pool support.

What annoys me is, that the argument is to “benchmark the GC”, but still includes languages without GC… So a language with equally powerful tools for memory management as a language without GC ends up worse off, just because it happens to have a GC.  
So either everyone should be allowed to use all tricks, or languages without GC should be excluded.

---

<div class="post-metadata">

**Author:** ![Yifan\_Liu](https://avatars.discourse-cdn.com/v4/letter/y/4da419/32.png) [@Yifan\_Liu](https://discourse.julialang.org/u/Yifan_Liu)\
**Post date:** [January 9, 2019, 4:48pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/65 "2019-01-09T16:48:11Z")

</div>

Chapel programming language has GC, but the performance shows good on the benchmarks game website

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [January 9, 2019, 4:55pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/66 "2019-01-09T16:55:16Z")

</div>

Chapel’s performance looks comparable to a fast Julia solution without memory pool.  
But if I remember correctly, the memory pool solution in Julia is almost the same speed as the fast C++ solution - which is ~4x faster!

---

<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:** [January 9, 2019, 5:11pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/67 "2019-01-09T17:11:06Z")

</div>

Would making each implementation a separate module and making use of precompilation be of any help, provided that Julia also get a compilation step in benchmarking?

I was also considering to publish results (perhaps only the current best vs. Julia) that considers the startup and JIT overhead if there is no licensing issue.

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [January 9, 2019, 5:13pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/68 "2019-01-09T17:13:08Z")

</div>

I started extracting parts of PackageCompiler into a single file to compile an executable from the julia script - which should end up in a very comparable solution to compiling a C program. If that works out, we should be able to remove the JIT overhead.

---

<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 9, 2019, 5:25pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/69 "2019-01-09T17:25:08Z")

</div>

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

I hate to be the guy defending Java, but there have been millions of dollars poured into making it go fast, and it’s no slouch in the performance department anymore.

In particular, I think type-unstable Julia is going to be slower than poorly-written Java in most cases. Of course, I’m not denying that well-written Julia is usually faster–and “scary-code” Julia is as fast as anything out there.

---

<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:** [January 9, 2019, 5:56pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/70 "2019-01-09T17:56:38Z")

</div>

Non-GCed languages get an unfair advantage and if the binary trees benchmark was fair, C++ would use smart pointers and be ranked slightly below Python.

However, it’s still a useful GC benchmark for the languages that don’t cheat. If we can beat Haskell or SBCL’s GC on the binarytrees benchmarks with the Julia GC, that’s already a major achievement.

---

<div class="post-metadata">

**Author:** ![sdanisch](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sdanisch/32/1406_2.png) [@sdanisch](https://discourse.julialang.org/u/sdanisch)\
**Post date:** [January 10, 2019, 11:24am UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/71 "2019-01-10T11:24:43Z")

</div>

Done the compilation to an executable: [protype to compile julia scripts to exe by SimonDanisch · Pull Request #35 · JuliaPerf/BenchmarksGame.jl · GitHub](https://github.com/KristofferC/BenchmarksGame.jl/pull/35)

---

<div class="post-metadata">

**Author:** ![tkoolen](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tkoolen/32/1603_2.png) [@tkoolen](https://discourse.julialang.org/u/tkoolen)\
**Post date:** [January 10, 2019, 1:15pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/72 "2019-01-10T13:15:52Z")

</div>

Sweet!

---

<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:** [January 22, 2019, 10:42am UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/73 "2019-01-22T10:42:28Z")

</div>

Is there any setting or flag on Julia to temporarily disable the GC and let the user do the work manually?

---

<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 22, 2019, 7:31pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/74 "2019-01-22T19:31:02Z")

</div>

Not to my limited knowledge, but if you’re really desperate, you can use Libc.malloc to get heap memory that isn’t owned by the garbage collector and just work with raw pointers, so the garbage collector has a lot less work to do. I’m NOT recommending this strategy, just pointing it out.

A better strategy would be just write code with all your arrays preallocated as constants and avoid allocation that way. Programming in this style also sucks, but it _does_ tend to be pretty darn fast, and it’s slightly less crazy than using malloc directly.

---

<div class="post-metadata">

**Author:** ![Tamas\_Papp](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tamas_papp/32/25949_2.png) [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Post date:** [January 22, 2019, 7:58pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/75 "2019-01-22T19:58:01Z")

</div>

> [@ninjaaron](#):
>
> just write code with all your arrays preallocated as constants and avoid allocation that way. Programming in this style also sucks, but it _does_ tend to be pretty darn fast, and it’s slightly less crazy than using malloc directly.

Preallocated buffers are used (and considered idiomatic) in Julia (eg see `LinearAlgebra`), while manual memory management is arguably not how Julia is normally used, so it goes against the spirit of the benchmarks.

The point of Julia is not merely to write fast code, it is to write fast _and elegant_ code.

---

<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 22, 2019, 8:24pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/76 "2019-01-22T20:24:56Z")

</div>

Preallocating buffers is also idiomatic in C, but it doesn’t make it a fun way to program!

But I agree that is much preferable to manual memory management, and that should probably be avoided for the benchmarks game. As stated, it’s not an approach I recommed, but it is a way to avoid GC if one absolutely must. I do think it’s cool that Julia actually makes memory management available to the user, even if it’s not recommended. I think it sort of speaks to the Julia ethos.

As mentioned earlier in the thread, part of the point of some of the benchmarks is to evaluate the efficiency of the garbage collector, so I doubt an answer that circumvents it would be accepted anyway.

---

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

</div>

If you hang on to a reference for your variables, the garbage collector won’t have anything to do. You could have a global `notgarbage Any[]` vector that you push stuff onto you don’t want GC’d. I think they have a name for this sort of thing in Java. Unless you call a library function that churns memory in some way of course.

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [January 23, 2019, 8:29pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/78 "2019-01-23T20:29:27Z")

</div>

why don’t you like preallocating arrays? I always really enjoy putting `!` after my functions, it feels like I’m really getting things done 🙂

---

<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 23, 2019, 9:52pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/79 "2019-01-23T21:52:50Z")

</div>

If you want to know what I really like, it’s getting good performance without having to think too much about performance! I’d have thought that would be obvious from the fact that I use Julia!

---

<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:** [January 23, 2019, 9:53pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/80 "2019-01-23T21:53:52Z")

</div>

This conversation seems many stepped removed from the topic at hand.

---

<div class="post-metadata">

**Author:** ![mkborregaard](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mkborregaard/32/556_2.png) [@mkborregaard](https://discourse.julialang.org/u/mkborregaard)\
**Post date:** [January 23, 2019, 11:06pm UTC](https://discourse.julialang.org/t/julia-programs-now-shown-on-benchmarks-game-website/17722/81 "2019-01-23T23:06:26Z")

</div>

I see that you, like me, like exclamation marks 😂  
Sorry Kristoffer.

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

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