# Julia 1.9 vs. 1.8 performance for comprehension and splatting?

**URL:** https://discourse.julialang.org/t/julia-1-9-vs-1-8-performance-for-comprehension-and-splatting/97521
**Category:** Performance
**Created:** [April 15, 2023, 8:00pm UTC](https://discourse.julialang.org/t/julia-1-9-vs-1-8-performance-for-comprehension-and-splatting/97521 "2023-04-15T20:00:04Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![greatpet](https://avatars.discourse-cdn.com/v4/letter/g/e495f1/32.png) [@greatpet](https://discourse.julialang.org/u/greatpet)
#### Post date: [April 15, 2023, 8:00pm UTC](https://discourse.julialang.org/t/julia-1-9-vs-1-8-performance-for-comprehension-and-splatting/97521/1 "2023-04-15T20:00:04Z")

</div>

Julia 1.9 seems to be slower than 1.8 for some comprehension and splatting code. Here’s a minimal working example. I’ve written functions for doubling the values of a dictionary, including a “normal” version involving a Dict comprehension and a contrived “crazy” version with both comprehension and splatting. For both versions, Julia-1.9.0-rc2 is slower than Julia 1.8.5 on my Linux laptop.

The benchmarking code is below:

```julia
# DoubleDict.jl

using BenchmarkTools

function double_dict_normal(a::Dict)
    Dict(k => v * 2 for (k, v) in a)
end

function double_dict_crazy(a::Dict)
    Dict(map(i -> i[1] => i[2] * 2, [a...]))
end

d1 = Dict(i => i+1 for i in 1:10^7)

@btime double_dict_normal(d1);
@btime double_dict_crazy(d1);

```

The result from Julia-1.8.5 is

```
  290.535 ms (7 allocations: 272.00 MiB)
  1.772 s (29999742 allocations: 1.54 GiB)

```

The result from Julia-1.9.0-rc2 is

```
  320.734 ms (7 allocations: 272.00 MiB)
  2.014 s (29999742 allocations: 1.54 GiB)

```

What should I take away from this? Does it mean I should pay more attention to avoiding allocation and type instability when using Julia 1.9?
