# Performance

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

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

**Page:** 76

---

## [Again on reaching optimal parallel scaling](https://discourse.julialang.org/t/again-on-reaching-optimal-parallel-scaling/73203)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 21\
**Last updated:** [December 18, 2021, 2:38am UTC](https://discourse.julialang.org/t/again-on-reaching-optimal-parallel-scaling/73203 "2021-12-18T02:38:34Z")

</div>

This is somewhat vague, and quite certainly not Julia specific, so any bibliography, reference, experience, is appreciated. I am benchmarking an implementation of cell lists to compute particle interactions and other pr…

---

## [Anonymous functions slower than proper functions?](https://discourse.julialang.org/t/anonymous-functions-slower-than-proper-functions/73275)

<div class="topic-metadata">

**Author:** [@FHell](https://discourse.julialang.org/u/FHell)\
**Replies:** 2\
**Last updated:** [December 17, 2021, 7:18pm UTC](https://discourse.julialang.org/t/anonymous-functions-slower-than-proper-functions/73275 "2021-12-17T19:18:29Z")

</div>

Is this expected behavior? I see a performance difference of a factor two for very simple functions. E.g.: using BenchmarkTools g1 = t -\> cos(t - 0.5 \* t^2) g2(t) = cos(t - 0.5 \* t^2) function h1() x = 0. for …

---

## [Can PyPlot generate plots from multiple threads?](https://discourse.julialang.org/t/can-pyplot-generate-plots-from-multiple-threads/68876)

<div class="topic-metadata">

**Author:** [@g2g](https://discourse.julialang.org/u/g2g)\
**Replies:** 4\
**Last updated:** [December 17, 2021, 12:39am UTC](https://discourse.julialang.org/t/can-pyplot-generate-plots-from-multiple-threads/68876 "2021-12-17T00:39:47Z")

</div>

I’m new to Julia but already impressed because Julia is 4x faster than GNU Octave at generating the approximately 6000 frames of a 3D plot animation (30 minutes versus 120 minutes) I am making. I am hoping to be able to …

---

## [Sincos slightly slower than sin and cos](https://discourse.julialang.org/t/sincos-slightly-slower-than-sin-and-cos/73207)

<div class="topic-metadata">

**Author:** [@markmbaum](https://discourse.julialang.org/u/markmbaum)\
**Replies:** 2\
**Last updated:** [December 16, 2021, 3:14pm UTC](https://discourse.julialang.org/t/sincos-slightly-slower-than-sin-and-cos/73207 "2021-12-16T15:14:32Z")

</div>

I have some pieces of code that require lots of sin and cos evaluations and I’m looking for ways to accelerate. I noticed that the sincos function seems slightly slower than calling sin and cos alone. julia\> using Bench…

---

## [Performance when chaining multiple macros](https://discourse.julialang.org/t/performance-when-chaining-multiple-macros/73173)

<div class="topic-metadata">

**Author:** [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Replies:** 2\
**Last updated:** [December 16, 2021, 12:22am UTC](https://discourse.julialang.org/t/performance-when-chaining-multiple-macros/73173 "2021-12-16T00:22:42Z")

</div>

I’m aware that macros such as @muladd from MuladdMacro.jl, @views, and @inbounds are occasionally very useful for performance. Might there be any problems with combining them in general? For example, is the following cha…

---

## [Why do large NTuples Allocate?](https://discourse.julialang.org/t/why-do-large-ntuples-allocate/73145)

<div class="topic-metadata">

**Author:** [@jg-854](https://discourse.julialang.org/u/jg-854)\
**Replies:** 6\
**Last updated:** [December 15, 2021, 3:13pm UTC](https://discourse.julialang.org/t/why-do-large-ntuples-allocate/73145 "2021-12-15T15:13:35Z")

</div>

I was surprised to find that generating Tuples via generators causes allocations for large generators… Using BenchmarkTools @btime NTuple{5,Float64}(1.0 for i=1:5) 1.500 ns (0 allocations: 0 bytes) @btime NTuple{50…

---

## [Interpolation.jl + Cuda.jl? Possible?](https://discourse.julialang.org/t/interpolation-jl-cuda-jl-possible/73096)

<div class="topic-metadata">

**Author:** [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)\
**Replies:** 2\
**Last updated:** [December 15, 2021, 9:17am UTC](https://discourse.julialang.org/t/interpolation-jl-cuda-jl-possible/73096 "2021-12-15T09:17:02Z")

</div>

Hi everyone. I want to add Cuda.jl and GPU processing to my current workflow. I know NOTHING about GPU but I like what I have seen in CUDA.jl. My main problem is that I (over)use Interpolations.jl to create interpolati…

---

## [KrylovKit.svdsolve() terminating too early, with non-orthogonal singular vectors](https://discourse.julialang.org/t/krylovkit-svdsolve-terminating-too-early-with-non-orthogonal-singular-vectors/73109)

<div class="topic-metadata">

**Author:** [@iamsuddhasattwa](https://discourse.julialang.org/u/iamsuddhasattwa)\
**Replies:** 0\
**Last updated:** [December 15, 2021, 2:36am UTC](https://discourse.julialang.org/t/krylovkit-svdsolve-terminating-too-early-with-non-orthogonal-singular-vectors/73109 "2021-12-15T02:36:28Z")

</div>

I have for long had troubles with the KrylovKit.svdsolve() method. I am using Julia version 1.7.0, and I am trying to find the SVD of a sparse 1001X1001 matrix. It seems that if I try to find L=150 svd pairs, the U, V ma…

---

## [Text Mining: Detect Strings: Word Lookup in a Large Corpus of Phrases Using a Large Dictionary](https://discourse.julialang.org/t/text-mining-detect-strings-word-lookup-in-a-large-corpus-of-phrases-using-a-large-dictionary/72665)

<div class="topic-metadata">

**Author:** [@aourednik](https://discourse.julialang.org/u/aourednik)\
**Replies:** 27\
**Last updated:** [December 15, 2021, 12:39am UTC](https://discourse.julialang.org/t/text-mining-detect-strings-word-lookup-in-a-large-corpus-of-phrases-using-a-large-dictionary/72665 "2021-12-15T00:39:19Z")

</div>

I am trying to port a multithreaded #RStats algorithm for detecting strings from a 200k long dictionary in a corpus of 1 million phrases (cf. Text Mining: Detect Strings: Very Fast Word Lookup in a Large Dictionary in R …

---

## [Tracking down slowness of using](https://discourse.julialang.org/t/tracking-down-slowness-of-using/73048)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 1\
**Last updated:** [December 14, 2021, 8:28am UTC](https://discourse.julialang.org/t/tracking-down-slowness-of-using/73048 "2021-12-14T08:28:22Z")

</div>

This is the speed I get with a clean .julia profile: julia\> @time using HTTP 0.185504 seconds (50.50 k allocations: 4.633 MiB, 85.81% compilation time) With non-default options I can get down to: julia\> @time using …

---

## [List functions that are not type stable?](https://discourse.julialang.org/t/list-functions-that-are-not-type-stable/72817)

<div class="topic-metadata">

**Author:** [@touste](https://discourse.julialang.org/u/touste)\
**Replies:** 7\
**Last updated:** [December 13, 2021, 10:53am UTC](https://discourse.julialang.org/t/list-functions-that-are-not-type-stable/72817 "2021-12-13T10:53:16Z")

</div>

Hi all, Is there a quick way to list functions that are not type stable during execution in a given module? I’m aware of the @code\_warntype macro, or the Cthulu package, but it can be quite cumbersome to descend into al…

---

## [Performance of Unitful Arrays](https://discourse.julialang.org/t/performance-of-unitful-arrays/52635)

<div class="topic-metadata">

**Author:** [@Gregstrq](https://discourse.julialang.org/u/Gregstrq)\
**Replies:** 8\
**Last updated:** [December 12, 2021, 3:57pm UTC](https://discourse.julialang.org/t/performance-of-unitful-arrays/52635 "2021-12-12T15:57:51Z")

</div>

Suppose I have a large matrix M composed of homogeneous Unitful data, and a vector v, which contains homogeneus Unitful data as well. (By Unitful data I mean the data with the types from Unitful.jl) Does the calculation…

---

## [Why is LLVM missing this constant in a loop?](https://discourse.julialang.org/t/why-is-llvm-missing-this-constant-in-a-loop/72941)

<div class="topic-metadata">

**Author:** [@Bardo](https://discourse.julialang.org/u/Bardo)\
**Replies:** 10\
**Last updated:** [December 11, 2021, 8:16pm UTC](https://discourse.julialang.org/t/why-is-llvm-missing-this-constant-in-a-loop/72941 "2021-12-11T20:16:11Z")

</div>

using BenchmarkTools using LinearAlgebra function f(x,y) z = 0.0 for i in 1:10 xy = x .\* y z += norm(xy) end z end function fopt(x,y) z = 0.0 xy = x .\* y for i in 1:10 …

---

## [Use of Channels (or similar) constructs in parallel processing](https://discourse.julialang.org/t/use-of-channels-or-similar-constructs-in-parallel-processing/18497)

<div class="topic-metadata">

**Author:** [@hesham](https://discourse.julialang.org/u/hesham)\
**Replies:** 4\
**Last updated:** [December 11, 2021, 8:26am UTC](https://discourse.julialang.org/t/use-of-channels-or-similar-constructs-in-parallel-processing/18497 "2021-12-11T08:26:23Z")

</div>

Hi, I have used Julia Channels in real-time processing of data in a pipeline fashion. Each Channel passes data to the next processing step. A simplified example is the code below, one channel for generating random numbe…

---

## [Seemingly unnecessary allocation within for loop](https://discourse.julialang.org/t/seemingly-unnecessary-allocation-within-for-loop/72556)

<div class="topic-metadata">

**Author:** [@mjg](https://discourse.julialang.org/u/mjg)\
**Replies:** 15\
**Last updated:** [December 10, 2021, 9:29pm UTC](https://discourse.julialang.org/t/seemingly-unnecessary-allocation-within-for-loop/72556 "2021-12-10T21:29:15Z")

</div>

I’m trying to create a simulation of an elastic string generalized to an arbitrary number of dimensions. To do so I track position and momentum (with an extra array to store the intermediate positions), and use the Euler…

---

## [Possible performance improvement in matrix multiplication involving a transpose and a complex matrix](https://discourse.julialang.org/t/possible-performance-improvement-in-matrix-multiplication-involving-a-transpose-and-a-complex-matrix/72813)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 3\
**Last updated:** [December 10, 2021, 3:56pm UTC](https://discourse.julialang.org/t/possible-performance-improvement-in-matrix-multiplication-involving-a-transpose-and-a-complex-matrix/72813 "2021-12-10T15:56:58Z")

</div>

julia\> ZC = rand(1800, 1680); M = rand(ComplexF64, 1800, 1800); julia\> @time ZC' \* M; 9.169792 seconds (3 allocations: 46.143 MiB) julia\> @time permutedims(ZC) \* M; 0.877853 seconds (6 allocations: 115.357 MiB, 1.5…

---

## [Searchsortedlast performance](https://discourse.julialang.org/t/searchsortedlast-performance/72711)

<div class="topic-metadata">

**Author:** [@snowgum](https://discourse.julialang.org/u/snowgum)\
**Replies:** 43\
**Last updated:** [December 9, 2021, 9:57pm UTC](https://discourse.julialang.org/t/searchsortedlast-performance/72711 "2021-12-09T21:57:23Z")

</div>

I am trying to write a Julia port of the Weno4Interpolation python package, an algorithm based on Janett et al. (2019) to perform higher order interpolations. The code itself is not complex, but has many statements, mos…

---

## [Benchmark macro with BenchmarkTools](https://discourse.julialang.org/t/benchmark-macro-with-benchmarktools/72723)

<div class="topic-metadata">

**Author:** [@mattwigway](https://discourse.julialang.org/u/mattwigway)\
**Replies:** 3\
**Last updated:** [December 9, 2021, 9:53pm UTC](https://discourse.julialang.org/t/benchmark-macro-with-benchmarktools/72723 "2021-12-09T21:53:51Z")

</div>

I’m benchmarking my package DiscreteChoiceModels.jl and comparing against other packages in R and Python. A significant entry point to the package is a macro which implements a domain-specific language to specify models.…

---

## [Allocations in advent of code](https://discourse.julialang.org/t/allocations-in-advent-of-code/72759)

<div class="topic-metadata">

**Author:** [@weymouth](https://discourse.julialang.org/u/weymouth)\
**Replies:** 9\
**Last updated:** [December 9, 2021, 5:24pm UTC](https://discourse.julialang.org/t/allocations-in-advent-of-code/72759 "2021-12-09T17:24:44Z")

</div>

I was fiddling around with the super fun advent of code this year and got surprised by an allocation in the day 5 puzzle. input = \[3,4,3,1,2\] histogram = \[count(==(i),input) for i in 0:8\] phase(day) = mod(day-1,9)+1 @al…

---

## [Linking to MKL 2019 with AMD CPUs?](https://discourse.julialang.org/t/linking-to-mkl-2019-with-amd-cpus/71508)

<div class="topic-metadata">

**Author:** [@pablosanjose](https://discourse.julialang.org/u/pablosanjose)\
**Replies:** 17\
**Last updated:** [December 9, 2021, 5:20pm UTC](https://discourse.julialang.org/t/linking-to-mkl-2019-with-amd-cpus/71508 "2021-12-09T17:20:12Z")

</div>

Question Does BinaryBuilder allow Ryzen/Threadripper owners to choose MKL 2019 as the binary to use for MKL.jl and MKLSparse.jl? Context Back in 2019 the MKL libraries had a “loophole” that allowed AMD CPUs to take adva…

---

## [Threads.@threads scheduling puzzle](https://discourse.julialang.org/t/threads-threads-scheduling-puzzle/72831)

<div class="topic-metadata">

**Author:** [@pitsianis](https://discourse.julialang.org/u/pitsianis)\
**Replies:** 2\
**Last updated:** [December 9, 2021, 3:56pm UTC](https://discourse.julialang.org/t/threads-threads-scheduling-puzzle/72831 "2021-12-09T15:56:27Z")

</div>

Consider this function test(duration) Threads.@threads for i=1:length(duration) sleep(duration\[i\]) end end In my 2 core computer, 4 total threads with hyperthreading, running the above with julia\> @time test(\[…

---

## [Undesired memory allocation during interpolation](https://discourse.julialang.org/t/undesired-memory-allocation-during-interpolation/72713)

<div class="topic-metadata">

**Author:** [@Gravlax](https://discourse.julialang.org/u/Gravlax)\
**Replies:** 33\
**Last updated:** [December 8, 2021, 6:56pm UTC](https://discourse.julialang.org/t/undesired-memory-allocation-during-interpolation/72713 "2021-12-08T18:56:26Z")

</div>

Dear all, I am writing a script that will require many interpolations in a row (10000s). I am trying to make it such that no allocation is made during the successive calls to Itp1D (). Therefore I’ve allocated all requ…

---

## [Using MKL in 1.7](https://discourse.julialang.org/t/using-mkl-in-1-7/72398)

<div class="topic-metadata">

**Author:** [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Replies:** 11\
**Last updated:** [December 8, 2021, 6:44pm UTC](https://discourse.julialang.org/t/using-mkl-in-1-7/72398 "2021-12-08T18:44:29Z")

</div>

My understanding is that all you need to do is type using MKL in the REPL and BLAS trampoline will take care of the rest. When I do that I see no difference in performance. What should I be doing? I’m on an Intel Mac …

---

## [Problems in 1.6.4 with IJulia. Downgrade to 1.6.3?](https://discourse.julialang.org/t/problems-in-1-6-4-with-ijulia-downgrade-to-1-6-3/72129)

<div class="topic-metadata">

**Author:** [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Replies:** 17\
**Last updated:** [December 8, 2021, 3:57pm UTC](https://discourse.julialang.org/t/problems-in-1-6-4-with-ijulia-downgrade-to-1-6-3/72129 "2021-12-08T15:57:24Z")

</div>

I am having a problem with IJulia throwing StackOverflowError: in 1.6.4. I am pretty sure that I was having no problem in 1.6.3 and have tested the notebook in 1.6.1 with no problems. Is there any way I can get 1.6.3 to…

---

## [Find the intersection of elements of powerset one by one](https://discourse.julialang.org/t/find-the-intersection-of-elements-of-powerset-one-by-one/72763)

<div class="topic-metadata">

**Author:** [@XLVII](https://discourse.julialang.org/u/XLVII)\
**Replies:** 3\
**Last updated:** [December 8, 2021, 3:02pm UTC](https://discourse.julialang.org/t/find-the-intersection-of-elements-of-powerset-one-by-one/72763 "2021-12-08T15:02:57Z")

</div>

Let S = { trigon, tetragon , pentagon , ... ,... } is a set of polygons How to calculate intersection of subsets of (every element actually) Powerset(S) Powerset(S) =\[ {} , {trigon} , {tetragon} , {pentagon} , {trigon,…

---

## [Reducing (time spent in) garbage collection](https://discourse.julialang.org/t/reducing-time-spent-in-garbage-collection/72715)

<div class="topic-metadata">

**Author:** [@sstroemer](https://discourse.julialang.org/u/sstroemer)\
**Replies:** 2\
**Last updated:** [December 7, 2021, 4:34pm UTC](https://discourse.julialang.org/t/reducing-time-spent-in-garbage-collection/72715 "2021-12-07T16:34:20Z")

</div>

I’m using the code posted below to create a simple JuMP model with variable size. Depending on the size and the way I construct the problem this induces somewhere between 20-80% of the total time spent in garbage collect…

---

## [Workflow question: loading models for simulation](https://discourse.julialang.org/t/workflow-question-loading-models-for-simulation/72709)

<div class="topic-metadata">

**Author:** [@ivborissov](https://discourse.julialang.org/u/ivborissov)\
**Replies:** 0\
**Last updated:** [December 7, 2021, 12:58pm UTC](https://discourse.julialang.org/t/workflow-question-loading-models-for-simulation/72709 "2021-12-07T12:58:50Z")

</div>

Hi, My question is related to optimization of the following workflow. I have a package MySimPkg to simulate ODE-based models and I load those models (currently julia .jl files) to run simulations. Each model.jl looks l…

---

## [Alternative to computation in a loop for distances for fast performance](https://discourse.julialang.org/t/alternative-to-computation-in-a-loop-for-distances-for-fast-performance/72642)

<div class="topic-metadata">

**Author:** [@nagda95](https://discourse.julialang.org/u/nagda95)\
**Replies:** 9\
**Last updated:** [December 7, 2021, 2:17am UTC](https://discourse.julialang.org/t/alternative-to-computation-in-a-loop-for-distances-for-fast-performance/72642 "2021-12-07T02:17:38Z")

</div>

Hello Everyone, I want to compute the distance (SqEuclidean) of a new point (newP) from the existing neighboring points in a specific order. I have the following code: newP=\[x y z\] for i in eachindex(order) Dist\[i\]=su…

---

## [Increase perfomance for Gillespie Algorithm](https://discourse.julialang.org/t/increase-perfomance-for-gillespie-algorithm/72369)

<div class="topic-metadata">

**Author:** [@Luis](https://discourse.julialang.org/u/Luis)\
**Replies:** 19\
**Last updated:** [December 6, 2021, 7:56pm UTC](https://discourse.julialang.org/t/increase-perfomance-for-gillespie-algorithm/72369 "2021-12-06T19:56:29Z")

</div>

I am relatively new to Julia and trying to implement a version of Gillespies Algorithm that can be used in population genetics. I tried really hard to make it as fast and light weighted as possible, incorporating most o…

---

## [Strange warning on PyPlot for 1.7.0 "vendor() is depreciated ..."](https://discourse.julialang.org/t/strange-warning-on-pyplot-for-1-7-0-vendor-is-depreciated/72675)

<div class="topic-metadata">

**Author:** [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Replies:** 2\
**Last updated:** [December 6, 2021, 7:17pm UTC](https://discourse.julialang.org/t/strange-warning-on-pyplot-for-1-7-0-vendor-is-depreciated/72675 "2021-12-06T19:17:31Z")

</div>

I’m using 1.7.0 on my Intel machines now with the MKL Blas and happily avoiding the OpenBlas problem. I got this message from PyPlot the first time I call it from 1.7.0 in a new REPL session but not for calls after that …

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

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