# Performance

**URL:** https://discourse.julialang.org/c/usage/perf/37.md?page=97

[Latest](https://discourse.julialang.org/latest.md) · [Categories](https://discourse.julialang.org/categories.md) · [Tags](https://discourse.julialang.org/tags.md)

**Page:** 98

---

## [Optimizing the calculation of many distances](https://discourse.julialang.org/t/optimizing-the-calculation-of-many-distances/57343)

<div class="topic-metadata">

**Author:** [@jsbyrnes](https://discourse.julialang.org/u/jsbyrnes)\
**Replies:** 28\
**Last updated:** [March 18, 2021, 5:11pm UTC](https://discourse.julialang.org/t/optimizing-the-calculation-of-many-distances/57343 "2021-03-18T17:11:08Z")

</div>

Hey everyone, I’m translating some code from Julia to MATLAB and I have a seismic imaging program that now works in Julia and is a bit faster than MATLAB - but not a ton. The profiler says that the function pasted below …

---

## [Help speeding up FFT processing code](https://discourse.julialang.org/t/help-speeding-up-fft-processing-code/57219)

<div class="topic-metadata">

**Author:** [@mihalybaci](https://discourse.julialang.org/u/mihalybaci)\
**Replies:** 9\
**Last updated:** [March 18, 2021, 2:24pm UTC](https://discourse.julialang.org/t/help-speeding-up-fft-processing-code/57219 "2021-03-18T14:24:01Z")

</div>

Hi all, I have a three functions that I have translated from Python and would like some assistance in improving their performance. The full working code is: using FFTW """ Implementation of numpy.roll """ roll(vec, num…

---

## [Best implementation for semiclassical dynamics in Julia](https://discourse.julialang.org/t/best-implementation-for-semiclassical-dynamics-in-julia/57423)

<div class="topic-metadata">

**Author:** [@ErikPillon](https://discourse.julialang.org/u/ErikPillon)\
**Replies:** 5\
**Last updated:** [March 18, 2021, 10:20am UTC](https://discourse.julialang.org/t/best-implementation-for-semiclassical-dynamics-in-julia/57423 "2021-03-18T10:20:53Z")

</div>

Dear all, I’m a Julia user since 2017 and after getting familiar with multiple dispatch and mutable structures, I finally found the courage to interact for the first time with the Julia community. Here’s my question. D…

---

## [Too much allocations](https://discourse.julialang.org/t/too-much-allocations/57366)

<div class="topic-metadata">

**Author:** [@powerzf](https://discourse.julialang.org/u/powerzf)\
**Replies:** 4\
**Last updated:** [March 18, 2021, 12:33am UTC](https://discourse.julialang.org/t/too-much-allocations/57366 "2021-03-18T00:33:59Z")

</div>

abstract type CVGSurface end struct Triangle \<: CVGSurface triangleID :: Int64 x :: Float64 y :: Float64 z :: Float64 end Triangle() = Triangle(1,1.0,1.0,1.0) struct TrBoundry \<:CVGSurface tri…

---

## [Read a dictionary JLD2 file dumped by python in julia](https://discourse.julialang.org/t/read-a-dictionary-jld2-file-dumped-by-python-in-julia/57418)

<div class="topic-metadata">

**Author:** [@Sebastian\_Mena](https://discourse.julialang.org/u/Sebastian_Mena)\
**Replies:** 3\
**Last updated:** [March 17, 2021, 10:17pm UTC](https://discourse.julialang.org/t/read-a-dictionary-jld2-file-dumped-by-python-in-julia/57418 "2021-03-17T22:17:04Z")

</div>

Hi, I am trying to import a dictionary that I saved in python with the extension .jld2 First, I tried this code to do that: \> using JSON \> using DataStructures \> using JLD2 \> dict\_name = load("path/dict\_name.jld2") A…

---

## [Performance of a key step in Strang Splitting method](https://discourse.julialang.org/t/performance-of-a-key-step-in-strang-splitting-method/57312)

<div class="topic-metadata">

**Author:** [@jacobusmmsmit](https://discourse.julialang.org/u/jacobusmmsmit)\
**Replies:** 10\
**Last updated:** [March 17, 2021, 8:39pm UTC](https://discourse.julialang.org/t/performance-of-a-key-step-in-strang-splitting-method/57312 "2021-03-17T20:39:08Z")

</div>

Hello, My friend is working on a problem solving a 3+1 Dimensional non-linear PDE using a two-step operator splitting scheme. His code is in MATLAB and I suggested he try out Julia as it gives you more of a toolkit to o…

---

## [Return type of \`sum\` with nested function is inferred as \`Any\`](https://discourse.julialang.org/t/return-type-of-sum-with-nested-function-is-inferred-as-any/57407)

<div class="topic-metadata">

**Author:** [@Uroc327](https://discourse.julialang.org/u/Uroc327)\
**Replies:** 6\
**Last updated:** [March 17, 2021, 8:30pm UTC](https://discourse.julialang.org/t/return-type-of-sum-with-nested-function-is-inferred-as-any/57407 "2021-03-17T20:30:40Z")

</div>

I have a function that sums over expressions calling nested functions. I noticed that the function runs rather slowly. Upon further investigation, julia seems to be unable to infer the return type of this function. The …

---

## [Vectorization when broadcasting vector of structs](https://discourse.julialang.org/t/vectorization-when-broadcasting-vector-of-structs/57410)

<div class="topic-metadata">

**Author:** [@gbaraldi](https://discourse.julialang.org/u/gbaraldi)\
**Replies:** 0\
**Last updated:** [March 17, 2021, 8:02pm UTC](https://discourse.julialang.org/t/vectorization-when-broadcasting-vector-of-structs/57410 "2021-03-17T20:02:11Z")

</div>

Recently on slack I was discussing about the performance of generic structs and whether or not they should be vectorized and while exploring I found some interesting results. using BenchmarkTools struct TestType{𝒯} …

---

## [Avoiding allocations for function arguments with non-concrete types](https://discourse.julialang.org/t/avoiding-allocations-for-function-arguments-with-non-concrete-types/57263)

<div class="topic-metadata">

**Author:** [@Nicholaswogan](https://discourse.julialang.org/u/Nicholaswogan)\
**Replies:** 8\
**Last updated:** [March 17, 2021, 6:34pm UTC](https://discourse.julialang.org/t/avoiding-allocations-for-function-arguments-with-non-concrete-types/57263 "2021-03-17T18:34:46Z")

</div>

Hi, I am beginning to learn how to build my own types, and pass them to functions with different methods for different input types. Below is a chemistry example problem. I do not understand one of the allocations involve…

---

## [ANN: LoopVectorization 0.12: multithreading and better handling of discontiguous memory accesses](https://discourse.julialang.org/t/ann-loopvectorization-0-12-multithreading-and-better-handling-of-discontiguous-memory-accesses/57262)

<div class="topic-metadata">

**Author:** [@Elrod](https://discourse.julialang.org/u/Elrod)\
**Replies:** 16\
**Last updated:** [March 17, 2021, 4:25pm UTC](https://discourse.julialang.org/t/ann-loopvectorization-0-12-multithreading-and-better-handling-of-discontiguous-memory-accesses/57262 "2021-03-17T16:25:48Z")

</div>

I thought LoopVectorization 0.12 brought enough exciting improvements to warrant an update. Probably most exciting is the addition of @avxt or equivalently @avx thread=true, which can automatically multithread for loops…

---

## [Does @benchmark accurately track PyCall allocations?](https://discourse.julialang.org/t/does-benchmark-accurately-track-pycall-allocations/57375)

<div class="topic-metadata">

**Author:** [@mihalybaci](https://discourse.julialang.org/u/mihalybaci)\
**Replies:** 2\
**Last updated:** [March 17, 2021, 12:41pm UTC](https://discourse.julialang.org/t/does-benchmark-accurately-track-pycall-allocations/57375 "2021-03-17T12:41:37Z")

</div>

In the few instances I have tried to compare PyCall+@benchmark versus timteit within Python, I get runtimes that are very similar (occasionally timing Python from Julia is 1-2 ms faster for some reason). But, does @bench…

---

## [Update julia 1.53 and 1.6 Beta problem](https://discourse.julialang.org/t/update-julia-1-53-and-1-6-beta-problem/53275)

<div class="topic-metadata">

**Author:** [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Replies:** 2\
**Last updated:** [March 16, 2021, 7:15am UTC](https://discourse.julialang.org/t/update-julia-1-53-and-1-6-beta-problem/53275 "2021-03-16T07:15:39Z")

</div>

Version 1.5.3 (2020-11-09) \_/ |\\\_\_'\_|\_|\_|\\\_\_'\_| | Official https://julialang.org/ release |\_\_/ | (@v1.5) pkg\> up Installing known registries into \`C:\\Users\\user\\.julia\` ERROR: SystemError: opening…

---

## [Julia slower than Matlab & Python? No](https://discourse.julialang.org/t/julia-slower-than-matlab-python-no/33128)

<div class="topic-metadata">

**Author:** [@Albert\_Zevelev](https://discourse.julialang.org/u/Albert_Zevelev)\
**Replies:** 119\
**Last updated:** [March 16, 2021, 1:00am UTC](https://discourse.julialang.org/t/julia-slower-than-matlab-python-no/33128 "2021-03-16T01:00:51Z")

</div>

A recent paper ML Software & Hardware for Econ finds Julia is often slower than Matlab & Numpy. Code for Option Pricing is here. Code for Dynamic Programming is here. Usually, writing Julia code similarly leads to eno…

---

## [Learning to optimize](https://discourse.julialang.org/t/learning-to-optimize/57207)

<div class="topic-metadata">

**Author:** [@lancejnelson](https://discourse.julialang.org/u/lancejnelson)\
**Replies:** 12\
**Last updated:** [March 15, 2021, 9:22pm UTC](https://discourse.julialang.org/t/learning-to-optimize/57207 "2021-03-15T21:22:06Z")

</div>

Still trying to build intuition for optimizing Julia code. Here is an MD code I translated from python. It already runs a lot faster than my python version but I feel like it could be faster. I’m more interested in le…

---

## [Type Instability in performance critical function](https://discourse.julialang.org/t/type-instability-in-performance-critical-function/57195)

<div class="topic-metadata">

**Author:** [@mroavi](https://discourse.julialang.org/u/mroavi)\
**Replies:** 17\
**Last updated:** [March 15, 2021, 6:12pm UTC](https://discourse.julialang.org/t/type-instability-in-performance-critical-function/57195 "2021-03-15T18:12:39Z")

</div>

I have a function that is critical in my code because it is called many times. I am trying to optimize it. The function takes in an N-dimensional factor and a tuple of variables. A factor consists of an N-dimensional ar…

---

## [LowRankApprox.jl and sketch.jl](https://discourse.julialang.org/t/lowrankapprox-jl-and-sketch-jl/57200)

<div class="topic-metadata">

**Author:** [@vlederer](https://discourse.julialang.org/u/vlederer)\
**Replies:** 0\
**Last updated:** [March 15, 2021, 3:06pm UTC](https://discourse.julialang.org/t/lowrankapprox-jl-and-sketch-jl/57200 "2021-03-15T15:06:18Z")

</div>

In LowRankApprox package we have access to sketching methods via sketch.jl. I only need to compute the sketching step below in pseudo-code: function f(Q::StridedMatrix{Float32}, Qv::StridedVector{Float32}, S…

---

## [Efficient popnfirst!?](https://discourse.julialang.org/t/efficient-popnfirst/57190)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 12\
**Last updated:** [March 15, 2021, 12:29pm UTC](https://discourse.julialang.org/t/efficient-popnfirst/57190 "2021-03-15T12:29:38Z")

</div>

Hi, I was wondering if it exists an efficient implementation of popfirst! for an array that allows a n argument to request multiple pops at once (instead of calling popfirst! n times). Like popfirst!(a::Array, n::Int =…

---

## [Access array elements in 'strided groups'](https://discourse.julialang.org/t/access-array-elements-in-strided-groups/57122)

<div class="topic-metadata">

**Author:** [@DrChainsaw](https://discourse.julialang.org/u/DrChainsaw)\
**Replies:** 2\
**Last updated:** [March 15, 2021, 9:40am UTC](https://discourse.julialang.org/t/access-array-elements-in-strided-groups/57122 "2021-03-15T09:40:05Z")

</div>

Sorry for confusing terminology, MWE probably makes it clearer function viewrows(data::Vector, start, stop, ncol) datamat = reshape(data, :, ncol) dataview = @view datamat\[start:stop, :\] return reshape(datav…

---

## [Hadamard.jl and fwht()](https://discourse.julialang.org/t/hadamard-jl-and-fwht/57185)

<div class="topic-metadata">

**Author:** [@vlederer](https://discourse.julialang.org/u/vlederer)\
**Replies:** 0\
**Last updated:** [March 15, 2021, 9:30am UTC](https://discourse.julialang.org/t/hadamard-jl-and-fwht/57185 "2021-03-15T09:30:46Z")

</div>

Hi, in order to use fwht() function from Hadamard.jl package, I have to resize the input vector A into a vector tempA of a length that can be write as a power of two. I am doing this in the srht() function below at row 2…

---

## [Orthogonalize.jl](https://discourse.julialang.org/t/orthogonalize-jl/57181)

<div class="topic-metadata">

**Author:** [@vlederer](https://discourse.julialang.org/u/vlederer)\
**Replies:** 0\
**Last updated:** [March 15, 2021, 8:57am UTC](https://discourse.julialang.org/t/orthogonalize-jl/57181 "2021-03-15T08:57:53Z")

</div>

Hi, using orthogonalize.jl from IterativeSolvers.jl I made some performance plots (dodgeTPSbench.png attached) where “ON” tags refers to the julia internal function orthogonalize\_and\_normalize!() and MGS referst to Modif…

---

## [Input Type](https://discourse.julialang.org/t/input-type/56716)

<div class="topic-metadata">

**Author:** [@vlederer](https://discourse.julialang.org/u/vlederer)\
**Replies:** 2\
**Last updated:** [March 15, 2021, 8:30am UTC](https://discourse.julialang.org/t/input-type/56716 "2021-03-15T08:30:49Z")

</div>

Hi, in a solver framework I am using a custom function which takes Array{\<:\*\*AbstractFloat,\*\*1} as input. In practice, This AbstractFloat can be either Float32 or Float64. In terms of performances, should I create two f…

---

## [Improvement on appending data using for loop](https://discourse.julialang.org/t/improvement-on-appending-data-using-for-loop/56686)

<div class="topic-metadata">

**Author:** [@FlatWhite17](https://discourse.julialang.org/u/FlatWhite17)\
**Replies:** 4\
**Last updated:** [March 14, 2021, 4:26pm UTC](https://discourse.julialang.org/t/improvement-on-appending-data-using-for-loop/56686 "2021-03-14T16:26:22Z")

</div>

Hi there, I’m from a non-CS background and new to Julia. My current project involves a matching process where for each treated unit (D=1), I need to find units in the donor space (D=0) that have variance of their outcom…

---

## [Matrix-Vector multiplication complex/real](https://discourse.julialang.org/t/matrix-vector-multiplication-complex-real/57129)

<div class="topic-metadata">

**Author:** [@jamblejoe](https://discourse.julialang.org/u/jamblejoe)\
**Replies:** 0\
**Last updated:** [March 14, 2021, 1:53pm UTC](https://discourse.julialang.org/t/matrix-vector-multiplication-complex-real/57129 "2021-03-14T13:53:18Z")

</div>

The functions executed for A\*y are different for A either real or complex.The first code uses BLAS gemv! (checked via @code\_native) A = rand(ComplexF64, n, n) y = rand(Float64, n) c = Vector{Complex64}(undef, n) mul!(…

---

## [Vector - Matrix - Vector multiplication](https://discourse.julialang.org/t/vector-matrix-vector-multiplication/57087)

<div class="topic-metadata">

**Author:** [@jamblejoe](https://discourse.julialang.org/u/jamblejoe)\
**Replies:** 19\
**Last updated:** [March 14, 2021, 10:14am UTC](https://discourse.julialang.org/t/vector-matrix-vector-multiplication/57087 "2021-03-14T10:14:19Z")

</div>

I want to calculate xMy, where M is a complex matrix given by M = (AB-CD)’ \* (AB-BC), and A,B,C,D are complex or real matrices, not of the same dimension, i.e. in general not square matrices. Some example matrices are gi…

---

## [Parallelizing multiple Crank–Nicolson solvers](https://discourse.julialang.org/t/parallelizing-multiple-crank-nicolson-solvers/56861)

<div class="topic-metadata">

**Author:** [@jagot](https://discourse.julialang.org/u/jagot)\
**Replies:** 21\
**Last updated:** [March 13, 2021, 5:26am UTC](https://discourse.julialang.org/t/parallelizing-multiple-crank-nicolson-solvers/56861 "2021-03-13T05:26:41Z")

</div>

Problem I’m trying to parallelize my time propagator and not seeing very encouraging results. A simple part is where I exponentiate a lot of independent operators using Crank–Nicolson: b\_i = \\exp(-\\mathrm{i}\\delta t h…

---

## [Overhead of \`Threads.@threads\`](https://discourse.julialang.org/t/overhead-of-threads-threads/53964)

<div class="topic-metadata">

**Author:** [@ranocha](https://discourse.julialang.org/u/ranocha)\
**Replies:** 30\
**Last updated:** [March 13, 2021, 4:01am UTC](https://discourse.julialang.org/t/overhead-of-threads-threads/53964 "2021-03-13T04:01:17Z")

</div>

There is a certain overhead of using \`Threads.@threads\` even if only a single threads is used.For example, running Julia v1.5.3 with julia --threads=1 yields julia\> using BenchmarkTools julia\> function foo\_serial…

---

## [Implications of --compile=min and --optimize=0, for dummies](https://discourse.julialang.org/t/implications-of-compile-min-and-optimize-0-for-dummies/56894)

<div class="topic-metadata">

**Author:** [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Replies:** 22\
**Last updated:** [March 12, 2021, 4:40pm UTC](https://discourse.julialang.org/t/implications-of-compile-min-and-optimize-0-for-dummies/56894 "2021-03-12T16:40:42Z")

</div>

I’m starting to build some command line interfaces for some projects, and trying to figure out the best practices. In Fredrik Ekre’s juliacon talk, he recommends one option is to use --compile=min --optimize=0, but I’m t…

---

## [Why does increasing the number of identical parallel operations increases each operation time?](https://discourse.julialang.org/t/why-does-increasing-the-number-of-identical-parallel-operations-increases-each-operation-time/57014)

<div class="topic-metadata">

**Author:** [@matthiasbe](https://discourse.julialang.org/u/matthiasbe)\
**Replies:** 6\
**Last updated:** [March 12, 2021, 2:00pm UTC](https://discourse.julialang.org/t/why-does-increasing-the-number-of-identical-parallel-operations-increases-each-operation-time/57014 "2021-03-12T14:00:21Z")

</div>

Hi, I am investigating on the scaling performance of my distributed linear algebra application. For this purpose I made very basic examples of identical operations done in parallel. In the following example, I don’t un…

---

## [How to efficiently exponentiate a complex (symmetric) tridiagonal matrix?](https://discourse.julialang.org/t/how-to-efficiently-exponentiate-a-complex-symmetric-tridiagonal-matrix/56982)

<div class="topic-metadata">

**Author:** [@schneiderfelipe](https://discourse.julialang.org/u/schneiderfelipe)\
**Replies:** 6\
**Last updated:** [March 12, 2021, 1:49pm UTC](https://discourse.julialang.org/t/how-to-efficiently-exponentiate-a-complex-symmetric-tridiagonal-matrix/56982 "2021-03-12T13:49:31Z")

</div>

Hi, I’m trying to efficiently obtain the exponential of a complex symmetric tridiagonal matrix (SymTridiagonal). Unfortunately, exp is neither defined for SymTridiagonal nor Tridiagonal. I believe this is because eigen …

---

## [ERROR: could not open file boot.jl](https://discourse.julialang.org/t/error-could-not-open-file-boot-jl/36277)

<div class="topic-metadata">

**Author:** [@Yousef\_Saber](https://discourse.julialang.org/u/Yousef_Saber)\
**Replies:** 8\
**Last updated:** [March 12, 2021, 12:17pm UTC](https://discourse.julialang.org/t/error-could-not-open-file-boot-jl/36277 "2021-03-12T12:17:59Z")

</div>

Ubuntu: 19.10 Julia: 1.3.1 when I try to generate LLVM bitcode I got this error joseph@joseph-X541UJ:~/Documents/Julia$ julia --output-bc test.jl ERROR: could not open file boot.jl my test.jl file contains print("He…

[Previous page](https://discourse.julialang.org/c/usage/perf/37.md?page=96)

[Next page](https://discourse.julialang.org/c/usage/perf/37.md?page=98)
