# A possible regression in 0.7?

**URL:** https://discourse.julialang.org/t/a-possible-regression-in-0-7/14597
**Category:** New to Julia
**Created:** [September 5, 2018, 8:01pm UTC](https://discourse.julialang.org/t/a-possible-regression-in-0-7/14597 "2018-09-05T20:01:11Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jianghaizhu](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jianghaizhu/32/1866_2.png) [@jianghaizhu](https://discourse.julialang.org/u/jianghaizhu)
#### Post date: [September 5, 2018, 8:01pm UTC](https://discourse.julialang.org/t/a-possible-regression-in-0-7/14597/1 "2018-09-05T20:01:11Z")

</div>

I am upgrading my old code to version 0.7. I stumbled onto this little weird difference in performance between Julia 0.6 and 0.7. Here is a MWE.

```julia
julia> function h()
           @inbounds for i = 1:5:180
               j = 5. / sind(i)
               length(0:j:360)
           end
       end

```

In Julia 0.6,

```julia
julia> @btime h()
  7.936 μs (0 allocations: 0 bytes)

```

In Julia 0.7,

```julia
julia> @btime h()
  21.553 μs (288 allocations: 12.38 KiB)

```

It is the line ` length(0:j:360)` that allocated memories and brought down the performance. If `j` is fixed, then no memory allocation. So what happened here?

---

<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: [September 5, 2018, 8:05pm UTC](https://discourse.julialang.org/t/a-possible-regression-in-0-7/14597/2 "2018-09-05T20:05:54Z")

</div>

Here’s a shorter example that demonstrates the issue:

```julia
julia> @btime 0:$(286.493442):360
  499.269 ns (8 allocations: 352 bytes)
0.0:286.493442:286.493442

```

weirdly, slightly adjusting the step prevents the allocations:

```julia
julia> @btime 0:$(286.49344):360
  188.621 ns (0 allocations: 0 bytes)

```

---

<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: [September 5, 2018, 9:00pm UTC](https://discourse.julialang.org/t/a-possible-regression-in-0-7/14597/3 "2018-09-05T21:00:54Z")

</div>

Seems to be the splatting at

> <https://github.com/JuliaLang/julia/blob/8d993569b86608f9588458930a203fa4bc29ad50/base/twiceprecision.jl#L335-L340>

```julia
julia> @btime Base.steprangelen_hp(Float64, 2.0, 25.0, 5, 10, 2)
  1.470 μs (6 allocations: 320 bytes)
-23.0:25.0:202.0

```

---

<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: [September 5, 2018, 9:14pm UTC](https://discourse.julialang.org/t/a-possible-regression-in-0-7/14597/4 "2018-09-05T21:14:06Z")

</div>

[https://github.com/JuliaLang/julia/pull/29060](https://github.com/JuliaLang/julia/pull/29060)
