# Unusual slow Julia code compared to C++?

**URL:** <https://discourse.julialang.org/t/unusual-slow-julia-code-compared-to-c/22987>\
**Category:** Performance\
**Created:** [April 10, 2019, 5:41am UTC](https://discourse.julialang.org/t/unusual-slow-julia-code-compared-to-c/22987 "2019-04-10T05:41:48Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![KestutisMa](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kestutisma/32/7835_2.png) [@KestutisMa](https://discourse.julialang.org/u/KestutisMa)\
**Post date:** [June 19, 2019, 6:37am UTC](https://discourse.julialang.org/t/unusual-slow-julia-code-compared-to-c/22987/21 "2019-06-19T06:37:49Z")

</div>

OK, thanks 🙂 interesting observations, I also did few optimizations to C++ code and results are (using simulation length 1000): C++ (GCC 8.3) 280 ms, Julia (v1.1.1) 240 ms. Perhaps both codes could be optimized a little more, but results are very good and Julia has potential to solve two-languages problem at this case. Julia code now is a bit longer but still shorter than C++. Now Julia with faster debugger would be a nice candidate for replacing MATLAB/Python for prototyping. 😉

---

<div class="post-metadata">

**Author:** ![anon67531922](https://avatars.discourse-cdn.com/v4/letter/a/48db29/32.png) [@anon67531922](https://discourse.julialang.org/u/anon67531922)\
**Post date:** [July 30, 2019, 4:03pm UTC](https://discourse.julialang.org/t/unusual-slow-julia-code-compared-to-c/22987/22 "2019-07-30T16:03:12Z")

</div>

> [@anon67531922](#):
>
> Usually, what happens is you build your prototype. Seeing a 10x slowdown compared to C++ with a prototype is actually pretty impressive I think. Once you have improved your typed stability, removed unnecessary allocations and done some other optimizations, I am 100% confident your model will run as fast or faster in Julia than C++. I’ve seen the same thing happen over and over again.

Yet again 🙂

[Previous page](https://discourse.julialang.org/t/unusual-slow-julia-code-compared-to-c/22987.md?page=1)
