# \[ANN\] New benchmark comparison

**URL:** <https://discourse.julialang.org/t/ann-new-benchmark-comparison/9689>\
**Category:** General Usage\
**Tags:** benchmark\
**Created:** [March 13, 2018, 4:35pm UTC](https://discourse.julialang.org/t/ann-new-benchmark-comparison/9689 "2018-03-13T16:35:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [March 13, 2018, 4:35pm UTC](https://discourse.julialang.org/t/ann-new-benchmark-comparison/9689/1 "2018-03-13T16:35:57Z")

</div>

There is a benchmark posted [here](https://github.com/precisesimulation/julia-matlab-fortran-fem-benchmark) of which I just became aware today. I will investigate a bit more, but if anyone has had a look already, I would appreciate any comments or insights.

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [March 13, 2018, 5:16pm UTC](https://discourse.julialang.org/t/ann-new-benchmark-comparison/9689/2 "2018-03-13T17:16:22Z")

</div>

I’m getting about a 2X speedup over their stored benchmarks just by using Julia v0.6 and fixing the deprecation warnings. But it looks like there are some pretty weird things being done in the Julia code, and I suspect a much larger speedup is possible. For example:

[https://github.com/precisesimulation/julia-matlab-fortran-fem-benchmark/blob/6b332124d7c9f8e98ca501dc426be1fb480742a8/src\_julia/fem\_poisson.jl#L125](https://github.com/precisesimulation/julia-matlab-fortran-fem-benchmark/blob/6b332124d7c9f8e98ca501dc426be1fb480742a8/src_julia/fem_poisson.jl#L125)

in which they take the `max`, `min`, and `sort` of scalars.

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [March 13, 2018, 5:19pm UTC](https://discourse.julialang.org/t/ann-new-benchmark-comparison/9689/3 "2018-03-13T17:19:41Z")

</div>

Oh, I see, that’s because the function appears to have some parts written as if `n_cx` might be a vector, although it never is (and, in fact, can’t be without throwing errors elsewhere). This is very matlab-y.

---

<div class="post-metadata">

**Author:** ![rdeits](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rdeits/32/286_2.png) [@rdeits](https://discourse.julialang.org/u/rdeits)\
**Post date:** [March 13, 2018, 5:36pm UTC](https://discourse.julialang.org/t/ann-new-benchmark-comparison/9689/4 "2018-03-13T17:36:42Z")

</div>

(post deleted because I realized later it was pretty obnoxious).

---

<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:** [March 13, 2018, 6:06pm UTC](https://discourse.julialang.org/t/ann-new-benchmark-comparison/9689/5 "2018-03-13T18:06:09Z")

</div>

In the article from the README, the author says the Julia code is a direct  
transcription of the Fortran code, so weirdness is more than to be expected.

---

<div class="post-metadata">

**Author:** ![barche](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/barche/32/79_2.png) [@barche](https://discourse.julialang.org/u/barche)\
**Post date:** [March 13, 2018, 6:53pm UTC](https://discourse.julialang.org/t/ann-new-benchmark-comparison/9689/6 "2018-03-13T18:53:43Z")

</div>

Some observations, only from looking at the README:

- The difference between these solver types is huge, it is not fair to compare a direct and an iterative solver, so essentially the comparison is limited to the assembly
- The fact that Matlab outperforms Fortran for the assembly phase probably means there is a lot of room for improvement there.
- Not counting the solve phase, Julia is pretty close to Fortran, not bad for a naive port I’d say 🙂
