# Performance

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

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

**Page:** 2

---

## [Non-allocating way to parse section of string as number?](https://discourse.julialang.org/t/non-allocating-way-to-parse-section-of-string-as-number/137672)

<div class="topic-metadata">

**Author:** [@AwesomeQuest](https://discourse.julialang.org/u/AwesomeQuest)\
**Replies:** 2\
**Last updated:** [June 17, 2026, 8:31pm UTC](https://discourse.julialang.org/t/non-allocating-way-to-parse-section-of-string-as-number/137672 "2026-06-17T20:31:57Z")

</div>

Given a big string with numbers in it like input = ";(,)\<mul(595,110)~ #(select()-?who():mul(732,729)+/;%@mul(924,700)" and I know at execution time exactly where a number is in the string, I can parse that section of …

---

## [Performance overhead of an indirection to basic array function](https://discourse.julialang.org/t/performance-overhead-of-an-indirection-to-basic-array-function/137663)

<div class="topic-metadata">

**Author:** [@Tortar](https://discourse.julialang.org/u/Tortar)\
**Replies:** 0\
**Last updated:** [June 16, 2026, 11:38pm UTC](https://discourse.julialang.org/t/performance-overhead-of-an-indirection-to-basic-array-function/137663 "2026-06-16T23:38:19Z")

</div>

I have a macro which creates these function indirections for very basic collection functions, i.e. it substitutes all Base.getindex instances with \_unchecked\_getindex: Base.@propagate\_inbounds @inline function \_unchecke…

---

## [Does the interactive thread have due performance?](https://discourse.julialang.org/t/does-the-interactive-thread-have-due-performance/137568)

<div class="topic-metadata">

**Author:** [@WalterMadelim](https://discourse.julialang.org/u/WalterMadelim)\
**Replies:** 1\
**Last updated:** [June 11, 2026, 3:54pm UTC](https://discourse.julialang.org/t/does-the-interactive-thread-have-due-performance/137568 "2026-06-11T15:54:51Z")

</div>

I have 2 physical chips on my machine, each having 64 physical cores. So there are 2 \* 2 \* 64 = 256 virtual processors. julia\> Sys.cpu\_summary() AMD EPYC 7763 64-Core Processor: speed user ni…

---

## [Writing to a shared buffer in multi-threaded for loop](https://discourse.julialang.org/t/writing-to-a-shared-buffer-in-multi-threaded-for-loop/137373)

<div class="topic-metadata">

**Author:** [@user664303](https://discourse.julialang.org/u/user664303)\
**Replies:** 17\
**Last updated:** [June 7, 2026, 5:53pm UTC](https://discourse.julialang.org/t/writing-to-a-shared-buffer-in-multi-threaded-for-loop/137373 "2026-06-07T17:53:38Z")

</div>

I have a for loop that iterates over millions of elements, each of which are processed quickly. Elements update random parts of a shared buffer. I’m trying to parallelize this operation in a performant way. I have consid…

---

## [GTK screen updating](https://discourse.julialang.org/t/gtk-screen-updating/137322)

<div class="topic-metadata">

**Author:** [@isaac-aderemi](https://discourse.julialang.org/u/isaac-aderemi)\
**Replies:** 1\
**Last updated:** [June 6, 2026, 5:50pm UTC](https://discourse.julialang.org/t/gtk-screen-updating/137322 "2026-06-06T17:50:30Z")

</div>

My question How does a person update the screen in gtk for a game or video updating? notes Glade was used to make the following code and I was wondering how I would update the screen (the ppm that is currently being use…

---

## [Best practice: threaded sparse matrix assembly](https://discourse.julialang.org/t/best-practice-threaded-sparse-matrix-assembly/137447)

<div class="topic-metadata">

**Author:** [@tduretz](https://discourse.julialang.org/u/tduretz)\
**Replies:** 13\
**Last updated:** [June 6, 2026, 1:57pm UTC](https://discourse.julialang.org/t/best-practice-threaded-sparse-matrix-assembly/137447 "2026-06-06T13:57:05Z")

</div>

What is current state-of-the-art regarding threaded sparse matrix assembly? We’re currently having an issue where sparse matrix assembly is taking more time than the linear solver (at low resolutions). One way to improv…

---

## [Anyone having performance issues with create\_sysimage on Fedora?](https://discourse.julialang.org/t/anyone-having-performance-issues-with-create-sysimage-on-fedora/137454)

<div class="topic-metadata">

**Author:** [@Deduction42](https://discourse.julialang.org/u/Deduction42)\
**Replies:** 6\
**Last updated:** [June 5, 2026, 10:50pm UTC](https://discourse.julialang.org/t/anyone-having-performance-issues-with-create-sysimage-on-fedora/137454 "2026-06-05T22:50:16Z")

</div>

I just started using Fedora, and tried using create\_sysimage on a project that usually takes 5 minutes minutes to complete on Windows/Ubuntu. After building it in Windows, with PackageCompiler v2.3.0, I tried building it…

---

## [Perf Julia@threads behind Numba@njit(parallel=True)](https://discourse.julialang.org/t/perf-julia-threads-behind-numba-njit-parallel-true/137388)

<div class="topic-metadata">

**Author:** [@cheng.wu](https://discourse.julialang.org/u/cheng.wu)\
**Replies:** 17\
**Last updated:** [June 2, 2026, 9:59am UTC](https://discourse.julialang.org/t/perf-julia-threads-behind-numba-njit-parallel-true/137388 "2026-06-02T09:59:33Z")

</div>

(This is a follow up to Julia vs Numba, having created a new discourse account) I came across this article on the performance of Julia vs Python+Numba, and this section interested me. It claims parallel Julia code is qu…

---

## [Can I decide if a program needs thread-safety at compile time based on the threads available by the julia process?](https://discourse.julialang.org/t/can-i-decide-if-a-program-needs-thread-safety-at-compile-time-based-on-the-threads-available-by-the-julia-process/137321)

<div class="topic-metadata">

**Author:** [@Tortar](https://discourse.julialang.org/u/Tortar)\
**Replies:** 7\
**Last updated:** [May 28, 2026, 8:43pm UTC](https://discourse.julialang.org/t/can-i-decide-if-a-program-needs-thread-safety-at-compile-time-based-on-the-threads-available-by-the-julia-process/137321 "2026-05-28T20:43:11Z")

</div>

i.e. can I do something like const needs\_thread\_safety = Threads.nthreads() == 1 ? false : true and then use the constant to compile differently if it is true or false (disabling atomics and/or locks if false)? Or do I…

---

## [How to combine @nospecialize with type parameters?](https://discourse.julialang.org/t/how-to-combine-nospecialize-with-type-parameters/137304)

<div class="topic-metadata">

**Author:** [@matthias314](https://discourse.julialang.org/u/matthias314)\
**Replies:** 6\
**Last updated:** [May 28, 2026, 11:29am UTC](https://discourse.julialang.org/t/how-to-combine-nospecialize-with-type-parameters/137304 "2026-05-28T11:29:20Z")

</div>

It seems that type parameters in functions prevent @nospecialize from having an effect: julia\> f(@nospecialize x::T) where T = 0; julia\> f(1); f(1.0); julia\> m = only(methods(f)); m.specializations |\> collect 7-elemen…

---

## [ForwardDiff Lie brackets allocate with StaticArrays](https://discourse.julialang.org/t/forwarddiff-lie-brackets-allocate-with-staticarrays/137248)

<div class="topic-metadata">

**Author:** [@tremelow](https://discourse.julialang.org/u/tremelow)\
**Replies:** 0\
**Last updated:** [May 22, 2026, 9:34pm UTC](https://discourse.julialang.org/t/forwarddiff-lie-brackets-allocate-with-staticarrays/137248 "2026-05-22T21:34:52Z")

</div>

I’m working on a code where I need Lie brackets of Lie brackets, but computing the Jacobian of a Lie bracket allocates data. Here’s a MWE using StaticArrays using BenchmarkTools import ForwardDiff f(x::SVector{2,T}) wh…

---

## [Performance of Julia binary wrapper behind Matlab mex-file interface performance](https://discourse.julialang.org/t/performance-of-julia-binary-wrapper-behind-matlab-mex-file-interface-performance/126946)

<div class="topic-metadata">

**Author:** [@andreasvarga](https://discourse.julialang.org/u/andreasvarga)\
**Replies:** 38\
**Last updated:** [May 17, 2026, 11:00pm UTC](https://discourse.julialang.org/t/performance-of-julia-binary-wrapper-behind-matlab-mex-file-interface-performance/126946 "2026-05-17T23:00:44Z")

</div>

Recently I implemented a julia wrapper for a subroutine of the SLICOT library (specifically SB03MD to solve Lyapunov matrix equations). I used the generated binary wrappers in conjunction with Intel’s MKL, which is used…

---

## [New to Julia - questions about optimizing my Turing code](https://discourse.julialang.org/t/new-to-julia-questions-about-optimizing-my-turing-code/137008)

<div class="topic-metadata">

**Author:** [@petalmokryn](https://discourse.julialang.org/u/petalmokryn)\
**Replies:** 8\
**Last updated:** [May 9, 2026, 8:53pm UTC](https://discourse.julialang.org/t/new-to-julia-questions-about-optimizing-my-turing-code/137008 "2026-05-09T20:53:58Z")

</div>

Hi everyone, nice to meet you I’m trying to write a custom multivariate model in Julia using banded matrix operations, starting with the simple example of a Gaussian random walk with IID innovations and IID observation …

---

## [Why are the FFT outputs always zero for some specific point numbers when using FFTW with MKL](https://discourse.julialang.org/t/why-are-the-fft-outputs-always-zero-for-some-specific-point-numbers-when-using-fftw-with-mkl/137038)

<div class="topic-metadata">

**Author:** [@DN\_Silence](https://discourse.julialang.org/u/DN_Silence)\
**Replies:** 1\
**Last updated:** [May 8, 2026, 1:44pm UTC](https://discourse.julialang.org/t/why-are-the-fft-outputs-always-zero-for-some-specific-point-numbers-when-using-fftw-with-mkl/137038 "2026-05-08T13:44:48Z")

</div>

I’m using an Intel CPU with Julia 1.12. When my FFT size is 178848185, whether I do FFT or rFFT, the output is always all zeros. But if I use fftw provider, it works normally. This issue is very easy to reproduce. The co…

---

## [Making Julia as Fast as C++](https://discourse.julialang.org/t/making-julia-as-fast-as-c/137016)

<div class="topic-metadata">

**Author:** [@linwaytin](https://discourse.julialang.org/u/linwaytin)\
**Replies:** 19\
**Last updated:** [May 8, 2026, 1:03pm UTC](https://discourse.julialang.org/t/making-julia-as-fast-as-c/137016 "2026-05-08T13:03:49Z")

</div>

This is an old post but it seems it hasn’t been discussed yet. An interesting observation the author found is that non-integer powers in Julia are fairly slow at that time, compared to C++. I am not sure if this is re…

---

## [Loading Unitful from cache takes forever at every VScode restart](https://discourse.julialang.org/t/loading-unitful-from-cache-takes-forever-at-every-vscode-restart/136979)

<div class="topic-metadata">

**Author:** [@alequa](https://discourse.julialang.org/u/alequa)\
**Replies:** 8\
**Last updated:** [May 6, 2026, 11:24am UTC](https://discourse.julialang.org/t/loading-unitful-from-cache-takes-forever-at-every-vscode-restart/136979 "2026-05-06T11:24:29Z")

</div>

Hello, I am using a large environment that loads several packages. The language server takes several minutes (!!!) every time it loads Unitful from cache. The other packages go just fine! \[ Info: Done loading EasyFit f…

---

## [Type stable \`mapreduce\` on Tuples](https://discourse.julialang.org/t/type-stable-mapreduce-on-tuples/136978)

<div class="topic-metadata">

**Author:** [@albertomercurio](https://discourse.julialang.org/u/albertomercurio)\
**Replies:** 6\
**Last updated:** [May 5, 2026, 2:52pm UTC](https://discourse.julialang.org/t/type-stable-mapreduce-on-tuples/136978 "2026-05-05T14:52:43Z")

</div>

Hello, I want to apply this very simple example of mapreduce involving eachindex on two tuples function test\_standard(x::Tuple, y::Tuple) length(x) == length(y) || throw(ArgumentError("Input tuples must have the sam…

---

## [Sum over LazyArray is slower than over regular array](https://discourse.julialang.org/t/sum-over-lazyarray-is-slower-than-over-regular-array/136989)

<div class="topic-metadata">

**Author:** [@jecs](https://discourse.julialang.org/u/jecs)\
**Replies:** 3\
**Last updated:** [May 5, 2026, 2:32pm UTC](https://discourse.julialang.org/t/sum-over-lazyarray-is-slower-than-over-regular-array/136989 "2026-05-05T14:32:56Z")

</div>

julia\> N = 64; A = randn(N,N); B = randn(N,N); C = similar(A,1,N); Using Lazy Arrays: julia\> @btime sum!($C,LazyArray(@~ $A.\*$B)) 3.047 μs (0 allocations: 0 bytes) Without LazyArrays: julia\> @btime sum!($C,$A.\*$B) …

---

## [Is the linear system solver \\ also multi threaded in Julia as in Matlab? And how to “multithread” it in Julia?](https://discourse.julialang.org/t/is-the-linear-system-solver-also-multi-threaded-in-julia-as-in-matlab-and-how-to-multithread-it-in-julia/47404)

<div class="topic-metadata">

**Author:** [@nico](https://discourse.julialang.org/u/nico)\
**Replies:** 34\
**Last updated:** [May 1, 2026, 7:34am UTC](https://discourse.julialang.org/t/is-the-linear-system-solver-also-multi-threaded-in-julia-as-in-matlab-and-how-to-multithread-it-in-julia/47404 "2026-05-01T07:34:35Z")

</div>

I am trying to compare speed and performance between Matlab and Julia. I am looking at a code that does topology optimization of a continuum structure subjected to a given load. The code I am looking at is the public cod…

---

## [Allocations from scalar arguments in functions](https://discourse.julialang.org/t/allocations-from-scalar-arguments-in-functions/136927)

<div class="topic-metadata">

**Author:** [@Pablo\_Montes](https://discourse.julialang.org/u/Pablo_Montes)\
**Replies:** 3\
**Last updated:** [April 30, 2026, 2:56pm UTC](https://discourse.julialang.org/t/allocations-from-scalar-arguments-in-functions/136927 "2026-04-30T14:56:08Z")

</div>

Hello, I am trying to optimize a code for simulating fluids that is currently allocating massive amounts of memory. I’m focusing on some specific functions that are simple but need to be called repeatedly (thousands of t…

---

## [Fast fixed point log](https://discourse.julialang.org/t/fast-fixed-point-log/136210)

<div class="topic-metadata">

**Author:** [@nhz2](https://discourse.julialang.org/u/nhz2)\
**Replies:** 5\
**Last updated:** [April 21, 2026, 4:55am UTC](https://discourse.julialang.org/t/fast-fixed-point-log/136210 "2026-04-21T04:55:49Z")

</div>

I’m trying to compute Float32 log(x) where x = (u + 0.5) / 2³² and u is a integer from 0 to 2³² - 1 I started with: @inline function fastlog1(u::UInt32)::Float32 if u \< UInt32(2)^31 x = fma(Float32(u), Floa…

---

## [Passing whole sequence to next layer from RNNCell in Lux](https://discourse.julialang.org/t/passing-whole-sequence-to-next-layer-from-rnncell-in-lux/136779)

<div class="topic-metadata">

**Author:** [@alequa](https://discourse.julialang.org/u/alequa)\
**Replies:** 0\
**Last updated:** [April 19, 2026, 4:42pm UTC](https://discourse.julialang.org/t/passing-whole-sequence-to-next-layer-from-rnncell-in-lux/136779 "2026-04-19T16:42:39Z")

</div>

Hello, I am trying to reproduce some basic code for training recurrent spiking networks. Here you can find an old porting for Flux from spytorch. I already adapted to the current Flux version, but I would really like t…

---

## [Another case of poor vectorization](https://discourse.julialang.org/t/another-case-of-poor-vectorization/136778)

<div class="topic-metadata">

**Author:** [@matthias314](https://discourse.julialang.org/u/matthias314)\
**Replies:** 1\
**Last updated:** [April 19, 2026, 2:08pm UTC](https://discourse.julialang.org/t/another-case-of-poor-vectorization/136778 "2026-04-19T14:08:54Z")

</div>

I see poor vectorization when creating ranges as tuples. The flavor is similar to this issue, but the details are different. This time there are no comparisons involved (which were the culprit in the linked post). funct…

---

## [Time to build system and problem is slower in Julia 1.12 with MTKv11](https://discourse.julialang.org/t/time-to-build-system-and-problem-is-slower-in-julia-1-12-with-mtkv11/135536)

<div class="topic-metadata">

**Author:** [@Wen-Wei\_Tseng](https://discourse.julialang.org/u/Wen-Wei_Tseng)\
**Replies:** 12\
**Last updated:** [April 17, 2026, 3:23pm UTC](https://discourse.julialang.org/t/time-to-build-system-and-problem-is-slower-in-julia-1-12-with-mtkv11/135536 "2026-04-17T15:23:38Z")

</div>

Hi, while I was trying the new version (v11) of ModelingToolkit.jl , I noticed it took longer to build the ODE system and problem under Julia 1.12. Here is the GitHub actions workflow running the script using ModelingT…

---

## [ResumableFunctions @yield doesn't work even in the simplest IO example](https://discourse.julialang.org/t/resumablefunctions-yield-doesnt-work-even-in-the-simplest-io-example/136713)

<div class="topic-metadata">

**Author:** [@tdm](https://discourse.julialang.org/u/tdm)\
**Replies:** 2\
**Last updated:** [April 15, 2026, 2:55am UTC](https://discourse.julialang.org/t/resumablefunctions-yield-doesnt-work-even-in-the-simplest-io-example/136713 "2026-04-15T02:55:59Z")

</div>

This is the simplest IO example (copied from AI) and explicitly supported in the docs: @resumable function read\_lines(filename) io = open(filename) try for line in eachline(io) @yield line …

---

## [Calling Julia from Python without severe startup](https://discourse.julialang.org/t/calling-julia-from-python-without-severe-startup/126949)

<div class="topic-metadata">

**Author:** [@Peter\_Job](https://discourse.julialang.org/u/Peter_Job)\
**Replies:** 5\
**Last updated:** [April 12, 2026, 4:59pm UTC](https://discourse.julialang.org/t/calling-julia-from-python-without-severe-startup/126949 "2026-04-12T16:59:37Z")

</div>

Hello! I’m writing this issue because when I googled around this issue, I found a few different solutions, and all of them have been either painful or slow. Hopefully a discoverable thread with the details of how we are…

---

## [Design patterns around large type unions](https://discourse.julialang.org/t/design-patterns-around-large-type-unions/136607)

<div class="topic-metadata">

**Author:** [@Deduction42](https://discourse.julialang.org/u/Deduction42)\
**Replies:** 6\
**Last updated:** [April 7, 2026, 5:50pm UTC](https://discourse.julialang.org/t/design-patterns-around-large-type-unions/136607 "2026-04-07T17:50:37Z")

</div>

I’m trying to build a chemical process modelling library that takes live sensor data as input, and one of the perennial challenges to this is the fact that there are many different types of flow meters with multiple inst…

---

## [Help eliminate a captured variable](https://discourse.julialang.org/t/help-eliminate-a-captured-variable/136585)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 1\
**Last updated:** [April 6, 2026, 10:51am UTC](https://discourse.julialang.org/t/help-eliminate-a-captured-variable/136585 "2026-04-06T10:51:08Z")

</div>

I am trying to eliminate a captured variable, as reported by JET.jl, in this piece of code, copied here for convenience: function transform\_with(flag::LogJacFlag, transformation::StaticArrayTransformation{D,S}, …

---

## [Reusing @local cache when multithreading](https://discourse.julialang.org/t/reusing-local-cache-when-multithreading/136579)

<div class="topic-metadata">

**Author:** [@amousavi](https://discourse.julialang.org/u/amousavi)\
**Replies:** 1\
**Last updated:** [April 6, 2026, 1:30am UTC](https://discourse.julialang.org/t/reusing-local-cache-when-multithreading/136579 "2026-04-06T01:30:17Z")

</div>

Hi everyone! I am trying to update an old project of mine where I have three nested for loops as such: scratch = zeros(Float32, tree\_nodes, nthreads()) collect\_here = zeros(Float32, nthreads()) for i in eachindex(V) @…

---

## [Poor vectorization when comparing unsigned integers](https://discourse.julialang.org/t/poor-vectorization-when-comparing-unsigned-integers/133122)

<div class="topic-metadata">

**Author:** [@matthias314](https://discourse.julialang.org/u/matthias314)\
**Replies:** 4\
**Last updated:** [April 5, 2026, 5:14am UTC](https://discourse.julialang.org/t/poor-vectorization-when-comparing-unsigned-integers/133122 "2026-04-05T05:14:45Z")

</div>

The following almost identical functions lead to quite different LLVM IR: function f(v::NTuple{N}, w::NTuple{N}, i) where N i = i % Int16 ntuple(Val(N)) do j j = j % Int16 ifelse(j \<= i, v\[j\], w…

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

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