# Performance

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

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

**Page:** 32

---

## [Adaptive time-stepping for semi-linear ODE (Kuramoto-Sivashinsky)](https://discourse.julialang.org/t/adaptive-time-stepping-for-semi-linear-ode-kuramoto-sivashinsky/108274)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 3\
**Last updated:** [January 3, 2024, 2:34pm UTC](https://discourse.julialang.org/t/adaptive-time-stepping-for-semi-linear-ode-kuramoto-sivashinsky/108274 "2024-01-03T14:34:33Z")

</div>

Hello, I am interested in solving the 1D Kuramoto-Sivashinsky equation for a field u(x,t) with periodic BCs: \\frac{\\partial u}{\\partial t} = - \\frac{\\partial^2 u}{\\partial x^2} - \\frac{\\partial^4 u}{\\partial x^4} - …

---

## [Examples of programs (simulations, etc.) sped up with StaticArrays](https://discourse.julialang.org/t/examples-of-programs-simulations-etc-sped-up-with-staticarrays/108270)

<div class="topic-metadata">

**Author:** [@awiersdorf](https://discourse.julialang.org/u/awiersdorf)\
**Replies:** 2\
**Last updated:** [January 2, 2024, 9:56pm UTC](https://discourse.julialang.org/t/examples-of-programs-simulations-etc-sped-up-with-staticarrays/108270 "2024-01-02T21:56:24Z")

</div>

Hey folks, I’m looking for some examples of programs that got sped up by using StaticArrays—do any of you have an example (preferably real-world or close to real-world) of a time when dropping StaticArrays into your pro…

---

## [Fast conversion from Matrix{Union{Missing, Float64}} to Sparse](https://discourse.julialang.org/t/fast-conversion-from-matrix-union-missing-float64-to-sparse/108161)

<div class="topic-metadata">

**Author:** [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Replies:** 11\
**Last updated:** [January 2, 2024, 2:10pm UTC](https://discourse.julialang.org/t/fast-conversion-from-matrix-union-missing-float64-to-sparse/108161 "2024-01-02T14:10:55Z")

</div>

I have a matrix that contains lots of missing values. I am toying with the idea of using sparsity to represent those missing values instead. However, one hurdle to easy conversion from Matrix to SparseMatrix is that the …

---

## [Are StaticArrays always faster?](https://discourse.julialang.org/t/are-staticarrays-always-faster/108225)

<div class="topic-metadata">

**Author:** [@Uranium238](https://discourse.julialang.org/u/Uranium238)\
**Replies:** 2\
**Last updated:** [January 1, 2024, 10:07am UTC](https://discourse.julialang.org/t/are-staticarrays-always-faster/108225 "2024-01-01T10:07:31Z")

</div>

I was under the impression that StaticArrays or operations that involve SMatrix are faster than the non Static counterparts. To test this out I wrote a small code that does matrix-multiplication related computations of a…

---

## [GPU parallelization for a very large system of ODEs](https://discourse.julialang.org/t/gpu-parallelization-for-a-very-large-system-of-odes/107187)

<div class="topic-metadata">

**Author:** [@ian](https://discourse.julialang.org/u/ian)\
**Replies:** 5\
**Last updated:** [December 30, 2023, 10:46am UTC](https://discourse.julialang.org/t/gpu-parallelization-for-a-very-large-system-of-odes/107187 "2023-12-30T10:46:48Z")

</div>

Hi all, I need to simulate a very large system of ODEs (~10^5 states). At every time step in the simulation I need to update a matrix using the current value of the state vector. Here is an MWE of the matrix updating f…

---

## [Bad performance of anonymous functions even when they are type-stable](https://discourse.julialang.org/t/bad-performance-of-anonymous-functions-even-when-they-are-type-stable/108173)

<div class="topic-metadata">

**Author:** [@frankwswang](https://discourse.julialang.org/u/frankwswang)\
**Replies:** 2\
**Last updated:** [December 30, 2023, 6:56am UTC](https://discourse.julialang.org/t/bad-performance-of-anonymous-functions-even-when-they-are-type-stable/108173 "2023-12-30T06:56:46Z")

</div>

MWE: julia\> f1 = function (x) x/2 end #3 (generic function with 1 method) julia\> function f1\_2(x) x/2 end f1\_2 (generic function with 1 method) julia\> f2 = function (x) …

---

## [Some notes on performance of callable structs](https://discourse.julialang.org/t/some-notes-on-performance-of-callable-structs/108042)

<div class="topic-metadata">

**Author:** [@arik](https://discourse.julialang.org/u/arik)\
**Replies:** 17\
**Last updated:** [December 30, 2023, 3:52am UTC](https://discourse.julialang.org/t/some-notes-on-performance-of-callable-structs/108042 "2023-12-30T03:52:05Z")

</div>

Hello together. I want to showcase some performance characteristics and slight problems with ‘homemade closures’. By that I mean some kind of struct that carries some data and has a call method in which this data is use…

---

## [Are branches in Julia a problem for performance?](https://discourse.julialang.org/t/are-branches-in-julia-a-problem-for-performance/108062)

<div class="topic-metadata">

**Author:** [@KZiemian](https://discourse.julialang.org/u/KZiemian)\
**Replies:** 10\
**Last updated:** [December 29, 2023, 8:55am UTC](https://discourse.julialang.org/t/are-branches-in-julia-a-problem-for-performance/108062 "2023-12-29T08:55:14Z")

</div>

Due to how modern CPU and computer memory works, branching, like using if statement, can produce high cost for the performance and produce cache misses. At basic level I understand that, but I’m deficiently not expert in…

---

## [Allocations from selecting fields of a named tuple](https://discourse.julialang.org/t/allocations-from-selecting-fields-of-a-named-tuple/108112)

<div class="topic-metadata">

**Author:** [@CameronBieganek](https://discourse.julialang.org/u/CameronBieganek)\
**Replies:** 4\
**Last updated:** [December 28, 2023, 12:53pm UTC](https://discourse.julialang.org/t/allocations-from-selecting-fields-of-a-named-tuple/108112 "2023-12-28T12:53:29Z")

</div>

There seems to be a large difference in the number allocations when selecting fields from a named tuple via two different approaches. using BenchmarkTools nt = (a=1, b=2, c=3) t = (:b, :c) If I use getindex, I get 6 al…

---

## [Trivial port from C++/Rust to Julia](https://discourse.julialang.org/t/trivial-port-from-c-rust-to-julia/105787)

<div class="topic-metadata">

**Author:** [@feribg](https://discourse.julialang.org/u/feribg)\
**Replies:** 51\
**Last updated:** [December 28, 2023, 5:21am UTC](https://discourse.julialang.org/t/trivial-port-from-c-rust-to-julia/105787 "2023-12-28T05:21:30Z")

</div>

I’m trying to port a very trivial MC simulation from C++ / Rust to Julia. Here are the 3 implementations: C++: (clang OSX) https://pastebin.com/HWEUxa6W Rust: https://pastebin.com/7d31ynJE Julia: https://pastebin.com…

---

## [Mutable struct assignment overloading / fast management of temporaries in expression](https://discourse.julialang.org/t/mutable-struct-assignment-overloading-fast-management-of-temporaries-in-expression/108056)

<div class="topic-metadata">

**Author:** [@mattsignorelli](https://discourse.julialang.org/u/mattsignorelli)\
**Replies:** 2\
**Last updated:** [December 26, 2023, 3:01pm UTC](https://discourse.julialang.org/t/mutable-struct-assignment-overloading-fast-management-of-temporaries-in-expression/108056 "2023-12-26T15:01:28Z")

</div>

I’m creating a package which interfaces to a C library with C structs, and implements all the operator overloading for these structs. For example it looks a bit like mutable struct MyStruct t::Ptr{CStruct} # Constru…

---

## [Windows is slower than WSL2 in loading GR, Preferences, Julia 1.9.0-beta2](https://discourse.julialang.org/t/windows-is-slower-than-wsl2-in-loading-gr-preferences-julia-1-9-0-beta2/92623)

<div class="topic-metadata">

**Author:** [@mkitti](https://discourse.julialang.org/u/mkitti)\
**Replies:** 8\
**Last updated:** [December 22, 2023, 4:29am UTC](https://discourse.julialang.org/t/windows-is-slower-than-wsl2-in-loading-gr-preferences-julia-1-9-0-beta2/92623 "2023-12-22T04:29:32Z")

</div>

I recently installed WSL 2. I noticed that @time\_imports reports faster import times for Preferences and GR under WSL2 than under Windows. The loading time for Preferences.jl is appears to be 10x worse. # WSL 2 julia\> @…

---

## [Efficiently check if a sparse vector is a column of a sparse matrix](https://discourse.julialang.org/t/efficiently-check-if-a-sparse-vector-is-a-column-of-a-sparse-matrix/107861)

<div class="topic-metadata">

**Author:** [@max29](https://discourse.julialang.org/u/max29)\
**Replies:** 13\
**Last updated:** [December 21, 2023, 2:57am UTC](https://discourse.julialang.org/t/efficiently-check-if-a-sparse-vector-is-a-column-of-a-sparse-matrix/107861 "2023-12-21T02:57:47Z")

</div>

I have a sparse matrix A and a sparse vector x and want to check if the vector is a column of the matrix. using SparseArrays, BenchmarkTools A = spdiagm(1:1000); x = sparsevec(\[950\],\[950\],1000); B = Array(A); # dense y…

---

## [Garbage collection and threading](https://discourse.julialang.org/t/garbage-collection-and-threading/107250)

<div class="topic-metadata">

**Author:** [@evan-wehi](https://discourse.julialang.org/u/evan-wehi)\
**Replies:** 17\
**Last updated:** [December 20, 2023, 4:57am UTC](https://discourse.julialang.org/t/garbage-collection-and-threading/107250 "2023-12-20T04:57:28Z")

</div>

I’ve been struggling with performance issues with my code for weeks. I’ve now narrowed down the primary problem to what seems to be a threading bottleneck in the garbage collector. Sorry, if this has been discussed alrea…

---

## [Array Contraction, LoopVectorization & AD](https://discourse.julialang.org/t/array-contraction-loopvectorization-ad/107721)

<div class="topic-metadata">

**Author:** [@marcobonici](https://discourse.julialang.org/u/marcobonici)\
**Replies:** 7\
**Last updated:** [December 18, 2023, 9:16pm UTC](https://discourse.julialang.org/t/array-contraction-loopvectorization-ad/107721 "2023-12-18T21:16:16Z")

</div>

Hi everyone, I have been using LoopVectorization.jl with very satisfactory results to speedup some calculations. Now, I have been hitting a problem: combining it with AD! Although my use case is not super complicated …

---

## [Efficient ways to raise an array by a scalar power](https://discourse.julialang.org/t/efficient-ways-to-raise-an-array-by-a-scalar-power/107688)

<div class="topic-metadata">

**Author:** [@valentin.m](https://discourse.julialang.org/u/valentin.m)\
**Replies:** 7\
**Last updated:** [December 18, 2023, 4:40pm UTC](https://discourse.julialang.org/t/efficient-ways-to-raise-an-array-by-a-scalar-power/107688 "2023-12-18T16:40:55Z")

</div>

Hello! I’m currently working on optimizing an algorithm to match the performance of an existing Fortran implementation. A key part of the algorithm involves computing the power of large arrays of floats raised to a scal…

---

## [Reinterpret vector into single struct](https://discourse.julialang.org/t/reinterpret-vector-into-single-struct/107709)

<div class="topic-metadata">

**Author:** [@Pablo\_Marchant](https://discourse.julialang.org/u/Pablo_Marchant)\
**Replies:** 9\
**Last updated:** [December 18, 2023, 10:46am UTC](https://discourse.julialang.org/t/reinterpret-vector-into-single-struct/107709 "2023-12-18T10:46:03Z")

</div>

Hi, I’m optimizing a bit of code where I need to reinterpret a vector into a struct. For example, I have the MWE example below struct Test a1::Float64 a2::Float64 end vec = \[2.0, 1.0\] using BenchmarkTools @be…

---

## [Chebyshev Transform using FFTW and FastTransforms.jl Speed](https://discourse.julialang.org/t/chebyshev-transform-using-fftw-and-fasttransforms-jl-speed/107387)

<div class="topic-metadata">

**Author:** [@erny123](https://discourse.julialang.org/u/erny123)\
**Replies:** 6\
**Last updated:** [December 16, 2023, 6:18pm UTC](https://discourse.julialang.org/t/chebyshev-transform-using-fftw-and-fasttransforms-jl-speed/107387 "2023-12-16T18:18:38Z")

</div>

I’m looking into spectral methods for some PDEs. For the discrete Chebyshev Transform, it is basically a discrete cosine transform: I’ve looked at FastTransforms.jl as they have a Chebyshev Transform which can be used…

---

## [Benchmarking Symbolics.jl against SymEngine.jl](https://discourse.julialang.org/t/benchmarking-symbolics-jl-against-symengine-jl/103744)

<div class="topic-metadata">

**Author:** [@certik](https://discourse.julialang.org/u/certik)\
**Replies:** 8\
**Last updated:** [December 15, 2023, 9:47pm UTC](https://discourse.julialang.org/t/benchmarking-symbolics-jl-against-symengine-jl/103744 "2023-12-15T21:47:26Z")

</div>

I finally found time to benchmark the Symbolics.jl against SymEngine.jl. Here are the results: Am I doing anything wrong with how I run them? So far on my computer Symbolics.jl seems slower. I want to make sure that I…

---

## [UndefVarError when using \`EnsembleDistributed()\` to solve \`ODEProblem\`](https://discourse.julialang.org/t/undefvarerror-when-using-ensembledistributed-to-solve-odeproblem/107434)

<div class="topic-metadata">

**Author:** [@johannesnauta](https://discourse.julialang.org/u/johannesnauta)\
**Replies:** 1\
**Last updated:** [December 14, 2023, 10:34am UTC](https://discourse.julialang.org/t/undefvarerror-when-using-ensembledistributed-to-solve-odeproblem/107434 "2023-12-14T10:34:22Z")

</div>

I am trying to solve relatively large systems of coupled ODEs, but I cannot seem to solve an EnsembleProblem(..) when the ODEProblem is generated using the @reaction\_network macro of Catalyst.jl (or, more specifically, w…

---

## [Custom data structure for repeatedly partial sorting constant-size array](https://discourse.julialang.org/t/custom-data-structure-for-repeatedly-partial-sorting-constant-size-array/107594)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 1\
**Last updated:** [December 14, 2023, 2:10am UTC](https://discourse.julialang.org/t/custom-data-structure-for-repeatedly-partial-sorting-constant-size-array/107594 "2023-12-14T02:10:35Z")

</div>

I have an application where, as a subroutine, I need to (partial) sort a specific n-dimensional vector repeatedly (for n\>10^7). Given initial data x^{(0)} and some perturbation \\epsilon^{(i)} in step i, I want to obtain x…

---

## [Even more interactive REPL](https://discourse.julialang.org/t/even-more-interactive-repl/107537)

<div class="topic-metadata">

**Author:** [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Replies:** 3\
**Last updated:** [December 13, 2023, 12:06am UTC](https://discourse.julialang.org/t/even-more-interactive-repl/107537 "2023-12-13T00:06:37Z")

</div>

Hi all :slight\_smile: Just stumbled over this. How difficult is it to implement such a repl mode?

---

## [How to copy the result of python to Julia without allocation memory using PyCall](https://discourse.julialang.org/t/how-to-copy-the-result-of-python-to-julia-without-allocation-memory-using-pycall/107480)

<div class="topic-metadata">

**Author:** [@wly](https://discourse.julialang.org/u/wly)\
**Replies:** 8\
**Last updated:** [December 12, 2023, 11:49am UTC](https://discourse.julialang.org/t/how-to-copy-the-result-of-python-to-julia-without-allocation-memory-using-pycall/107480 "2023-12-12T11:49:19Z")

</div>

I have a Python program whose results will be saved in a big numpy array. I want to use this result in my Julia program, but I find that accessing the data will cause memory allocation in Julia. A demo is as follows: us…

---

## [Threads.@spawn weird ouput message](https://discourse.julialang.org/t/threads-spawn-weird-ouput-message/94548)

<div class="topic-metadata">

**Author:** [@CeterisPartybus](https://discourse.julialang.org/u/CeterisPartybus)\
**Replies:** 6\
**Last updated:** [December 12, 2023, 1:57am UTC](https://discourse.julialang.org/t/threads-spawn-weird-ouput-message/94548 "2023-12-12T01:57:51Z")

</div>

Hi everyone, I am testing two parallel versions of my loop - one with @threads and one with @spawn. Weirdly, @spawn finishes in a fraction of the time @threads needs, makes much fewer allocations, and gives me this weir…

---

## [Understanding performance of vectors](https://discourse.julialang.org/t/understanding-performance-of-vectors/107455)

<div class="topic-metadata">

**Author:** [@D-Se](https://discourse.julialang.org/u/D-Se)\
**Replies:** 6\
**Last updated:** [December 11, 2023, 11:10pm UTC](https://discourse.julialang.org/t/understanding-performance-of-vectors/107455 "2023-12-11T23:10:52Z")

</div>

I have created a toy package, TicTacToes.jl to try and write and package some performant Julia code. When trying to write an example on how to use make a (bad) agent play itself, I didn’t understand the performance of o…

---

## [Multi-threading + curve\_fit no acceleration but increase the memory consumption on my server](https://discourse.julialang.org/t/multi-threading-curve-fit-no-acceleration-but-increase-the-memory-consumption-on-my-server/107429)

<div class="topic-metadata">

**Author:** [@aTrotier](https://discourse.julialang.org/u/aTrotier)\
**Replies:** 0\
**Last updated:** [December 11, 2023, 11:40am UTC](https://discourse.julialang.org/t/multi-threading-curve-fit-no-acceleration-but-increase-the-memory-consumption-on-my-server/107429 "2023-12-11T11:40:11Z")

</div>

Hi, I am working with 3D + temporal dimension (12812896\*50) MRI datasets that I want to fit using curve\_fit with the following model. The memory consumption is particularly important using multi-threading and does not …

---

## [Iterative construction of lazy Iterators leads to excessive compilation time](https://discourse.julialang.org/t/iterative-construction-of-lazy-iterators-leads-to-excessive-compilation-time/106766)

<div class="topic-metadata">

**Author:** [@\_cao](https://discourse.julialang.org/u/_cao)\
**Replies:** 21\
**Last updated:** [December 10, 2023, 8:19pm UTC](https://discourse.julialang.org/t/iterative-construction-of-lazy-iterators-leads-to-excessive-compilation-time/106766 "2023-12-10T20:19:00Z")

</div>

I wanted to write an iterator that lazily traverses a graph in breadth first search order, where the graph is defined implicitly by a function giving for each vertex an iterable over the adjacent vertices. This is what I…

---

## [Different \`@code\_llvm\` output on macos and x86](https://discourse.julialang.org/t/different-code-llvm-output-on-macos-and-x86/107338)

<div class="topic-metadata">

**Author:** [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Replies:** 4\
**Last updated:** [December 8, 2023, 7:17pm UTC](https://discourse.julialang.org/t/different-code-llvm-output-on-macos-and-x86/107338 "2023-12-08T19:17:31Z")

</div>

Hi, I wonder about the different outputs I obtain from @code\_llvm with the same Julia version (1.10.rc2) on different architectures (arm vs x86). The following script: f(a,b) = a .+ b f (generic function with 1 method…

---

## [Looping over a thousand files and checking if empty](https://discourse.julialang.org/t/looping-over-a-thousand-files-and-checking-if-empty/107291)

<div class="topic-metadata">

**Author:** [@Balinus](https://discourse.julialang.org/u/Balinus)\
**Replies:** 15\
**Last updated:** [December 8, 2023, 4:39pm UTC](https://discourse.julialang.org/t/looping-over-a-thousand-files-and-checking-if-empty/107291 "2023-12-08T16:39:31Z")

</div>

Hello! I have some results of an experiment. They are stored inside a folder and I need to open the files, check what is the fraction of missing values inside a file and tag it according to different level of missing va…

---

## [Parametric types and StaticArrays](https://discourse.julialang.org/t/parametric-types-and-staticarrays/107312)

<div class="topic-metadata">

**Author:** [@jondavis847](https://discourse.julialang.org/u/jondavis847)\
**Replies:** 2\
**Last updated:** [December 8, 2023, 9:27am UTC](https://discourse.julialang.org/t/parametric-types-and-staticarrays/107312 "2023-12-08T09:27:22Z")

</div>

As I’ve worked through a couple projects now, I realized I don’t fully understand the nuances of parametric types, and specifically when used with StaticArrays. My goal of course is to get all the performance I can, but …

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

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