# Performance of naive convolution against Python Numpy

**URL:** <https://discourse.julialang.org/t/performance-of-naive-convolution-against-python-numpy/75603>\
**Category:** New to Julia\
**Tags:** performance, loopvectorization\
**Created:** [February 1, 2022, 8:33pm UTC](https://discourse.julialang.org/t/performance-of-naive-convolution-against-python-numpy/75603 "2022-02-01T20:33:59Z")\
**Posts on this page:** 1\
**Page:** 2

<div class="post-metadata">

**Author:** ![romainvieme](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/romainvieme/32/33349_2.png) [@romainvieme](https://discourse.julialang.org/u/romainvieme)\
**Post date:** [February 4, 2022, 12:05pm UTC](https://discourse.julialang.org/t/performance-of-naive-convolution-against-python-numpy/75603/21 "2022-02-04T12:05:18Z")

</div>

In case anyone bumps into this thread again and wonders the same things than I am, `@tturbo` _uses multithreading by default_ but you need to start Julia with several threads to see the difference. So for a fair comparison:

```julia
julia

```

```julia
julia> @btime C=np.convolve(A, B, "full") setup=(A=rand(10000); B=rand(10000)) evals=100;
  18.287 ms (41 allocations: 158.09 KiB)

julia> @btime naive_convol_full!(D,A,B) setup=(A=rand(10000); B=rand(10000); D=zeros(length(A)+length(B)-1)) evals=100;
  11.768 ms (0 allocations: 0 bytes)

```

and with

```julia
julia -t 16

```

```julia
julia> @btime C=np.convolve(A, B, "full") setup=(A=rand(10000); B=rand(10000)) evals=100;
  18.515 ms (41 allocations: 158.09 KiB)

julia> @btime naive_convol_full!(D,A,B) setup=(A=rand(10000); B=rand(10000); D=zeros(length(A)+length(B)-1)) evals=100;
  6.763 ms (0 allocations: 0 bytes)

```

[Previous page](https://discourse.julialang.org/t/performance-of-naive-convolution-against-python-numpy/75603.md?page=1)
