# 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:** 1
**Showing post:** 19

<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: [June 17, 2019, 5:53pm UTC](https://discourse.julialang.org/t/unusual-slow-julia-code-compared-to-c/22987/19 "2019-06-17T17:53:20Z")

</div>

The difference in iteration counts is telling. For x86 registers have more precision than memory for doubles ( in a register it’s 80-bit ), so you can end up with different results given initial conditions depending on how the registers are utilized. You may have denormals as well. Try setting the cpu to flush them in Julia, might be a source of the performance difference.

from: [50x speed difference in gemv for different values in vector](https://discourse.julialang.org/t/50x-speed-difference-in-gemv-for-different-values-in-vector/2755)

```
set_zero_subnormals(true)

```

---

_[View the full topic](https://discourse.julialang.org/t/unusual-slow-julia-code-compared-to-c/22987)._
