# Performance

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

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

**Page:** 4

---

## [Speeding up trig-heavy code](https://discourse.julialang.org/t/speeding-up-trig-heavy-code/134656)

<div class="topic-metadata">

**Author:** [@langestefan](https://discourse.julialang.org/u/langestefan)\
**Replies:** 26\
**Last updated:** [January 2, 2026, 4:44pm UTC](https://discourse.julialang.org/t/speeding-up-trig-heavy-code/134656 "2026-01-02T16:44:23Z")

</div>

Hello! I recently released v0.3.2 of SolarPosition.jl. I feel like it is now in a position where I am very happy with the performance, at least I think I covered all the basics like type stability covered in Performance…

---

## [Using Combinatorics: permutations much slower than copied source code](https://discourse.julialang.org/t/using-combinatorics-permutations-much-slower-than-copied-source-code/134407)

<div class="topic-metadata">

**Author:** [@depial](https://discourse.julialang.org/u/depial)\
**Replies:** 11\
**Last updated:** [December 26, 2025, 2:46am UTC](https://discourse.julialang.org/t/using-combinatorics-permutations-much-slower-than-copied-source-code/134407 "2025-12-26T02:46:06Z")

</div>

When trying to solve an alphametics problem with permutations from Combinatorics.jl, I came across something I don’t understand about the performance. If I introduce permutations to the namespace via using Combinatorics…

---

## [Static vectors of vectors slow?](https://discourse.julialang.org/t/static-vectors-of-vectors-slow/134720)

<div class="topic-metadata">

**Author:** [@rokke](https://discourse.julialang.org/u/rokke)\
**Replies:** 3\
**Last updated:** [December 24, 2025, 12:11pm UTC](https://discourse.julialang.org/t/static-vectors-of-vectors-slow/134720 "2025-12-24T12:11:17Z")

</div>

first, I introduce some very similar ways to represent some boring data, with reasonable benchmarks: julia\> a=SVector{3, MVector{3,Int}}(\[MVector{3,Int}(\[1,1,1\]),MVector{3,Int}(\[1,1,1\]),MVector{3,Int}(\[1,1,1\])\]) 3-eleme…

---

## [Convert or Reinterpret Between NamedTuple and SVector](https://discourse.julialang.org/t/convert-or-reinterpret-between-namedtuple-and-svector/134600)

<div class="topic-metadata">

**Author:** [@cortner](https://discourse.julialang.org/u/cortner)\
**Replies:** 7\
**Last updated:** [December 17, 2025, 7:33pm UTC](https://discourse.julialang.org/t/convert-or-reinterpret-between-namedtuple-and-svector/134600 "2025-12-17T19:33:07Z")

</div>

My question is related to Vector to NamedTuple? Assume my NamedTuple contains only floating point values T and SVector{N, T} entries, e.g., using StaticArrays nt = ( a = rand(), b = SA\[1.0, 2.0 ,3.0\] ) Taking such a N…

---

## [Very slow training of Neural ODE with exogeneous input compared to jax using dense interpolated solution](https://discourse.julialang.org/t/very-slow-training-of-neural-ode-with-exogeneous-input-compared-to-jax-using-dense-interpolated-solution/134557)

<div class="topic-metadata">

**Author:** [@johtok](https://discourse.julialang.org/u/johtok)\
**Replies:** 4\
**Last updated:** [December 15, 2025, 11:09pm UTC](https://discourse.julialang.org/t/very-slow-training-of-neural-ode-with-exogeneous-input-compared-to-jax-using-dense-interpolated-solution/134557 "2025-12-15T23:09:39Z")

</div>

Hi guys! Ive been breaking my neck trying to get a julia alternative to this jax neural ode with exogeneous input script working but without luck! The julia version is painfully slow whereas the jax version runs in a c…

---

## [Static call at runtime](https://discourse.julialang.org/t/static-call-at-runtime/134516)

<div class="topic-metadata">

**Author:** [@epilliat](https://discourse.julialang.org/u/epilliat)\
**Replies:** 7\
**Last updated:** [December 14, 2025, 9:55am UTC](https://discourse.julialang.org/t/static-call-at-runtime/134516 "2025-12-14T09:55:56Z")

</div>

This problem comes from several pieces of code I’ve been struggling to optimize due to missunderstanding of Julia compiler. I would like to know if there are any “standard” way to do this. Consider a function f that doe…

---

## [Understanding memory usage in Julia](https://discourse.julialang.org/t/understanding-memory-usage-in-julia/101647)

<div class="topic-metadata">

**Author:** [@Andrea\_Vigliotti](https://discourse.julialang.org/u/Andrea_Vigliotti)\
**Replies:** 23\
**Last updated:** [December 12, 2025, 4:30pm UTC](https://discourse.julialang.org/t/understanding-memory-usage-in-julia/101647 "2025-12-12T16:30:39Z")

</div>

I am working on a finite element program that solves a non linear problem by incrementing the boundary conditions, that means that from time to time I need to assemble some quite large stiffness matrices (\\approx 350k \\t…

---

## [Improving Base.mapreduce by 20% on vectors](https://discourse.julialang.org/t/improving-base-mapreduce-by-20-on-vectors/134478)

<div class="topic-metadata">

**Author:** [@epilliat](https://discourse.julialang.org/u/epilliat)\
**Replies:** 2\
**Last updated:** [December 12, 2025, 1:32pm UTC](https://discourse.julialang.org/t/improving-base-mapreduce-by-20-on-vectors/134478 "2025-12-12T13:32:17Z")

</div>

Hello everyone, I’ve been exploring reduction operations on GPUs recently, and this led me to investigate CPU performance as well. I discovered that we can improve mapreduce in Base while maintaining full precision for …

---

## [Performance challenge: can you write a faster sum?](https://discourse.julialang.org/t/performance-challenge-can-you-write-a-faster-sum/130456)

<div class="topic-metadata">

**Author:** [@mbauman](https://discourse.julialang.org/u/mbauman)\
**Replies:** 32\
**Last updated:** [December 11, 2025, 10:03pm UTC](https://discourse.julialang.org/t/performance-challenge-can-you-write-a-faster-sum/130456 "2025-12-11T22:03:55Z")

</div>

OK, I’ve been fiddling with this on and off for a month now, but I’m curious if anyone can do better. Here’s the challenge: write a single generic implementation of sum(A) such that it’s fast for both A = rand(10000) an…

---

## [Help - not so zero-cost abstraction](https://discourse.julialang.org/t/help-not-so-zero-cost-abstraction/134435)

<div class="topic-metadata">

**Author:** [@anicusan](https://discourse.julialang.org/u/anicusan)\
**Replies:** 11\
**Last updated:** [December 10, 2025, 7:30pm UTC](https://discourse.julialang.org/t/help-not-so-zero-cost-abstraction/134435 "2025-12-10T19:30:18Z")

</div>

My problem is about an interface, and how to get the compiler to optimise it away. Say I have a Matrix with 6 rows and N columns - rows 1-3 represent position and rows 4-6 are velocity; each column is a body in a simula…

---

## [Self-inflicted type proliferation](https://discourse.julialang.org/t/self-inflicted-type-proliferation/134450)

<div class="topic-metadata">

**Author:** [@nilsbecker](https://discourse.julialang.org/u/nilsbecker)\
**Replies:** 3\
**Last updated:** [December 10, 2025, 8:34am UTC](https://discourse.julialang.org/t/self-inflicted-type-proliferation/134450 "2025-12-10T08:34:02Z")

</div>

I have the feeling I’m overdoing it / not doing the right thing with types. I’m wrapping ODESolutions coming from OrdinaryDifferentialEquations for downstream use like this: struct SolSR\_FS{T\<:Real,O,B} \<: SolSR sol::…

---

## [Extra line reduces run time by half, but why?](https://discourse.julialang.org/t/extra-line-reduces-run-time-by-half-but-why/134432)

<div class="topic-metadata">

**Author:** [@SneakyNewt](https://discourse.julialang.org/u/SneakyNewt)\
**Replies:** 3\
**Last updated:** [December 8, 2025, 3:50pm UTC](https://discourse.julialang.org/t/extra-line-reduces-run-time-by-half-but-why/134432 "2025-12-08T15:50:42Z")

</div>

From Advent of Code Day 7, so be warned for spoilers. I created my solution and found weird behaviors where running other functions/lines made the rest of my code run far faster, but wasn’t sure why. After a very tediou…

---

## [Multithreading non-contiguous mapreduction over huge matrices](https://discourse.julialang.org/t/multithreading-non-contiguous-mapreduction-over-huge-matrices/134413)

<div class="topic-metadata">

**Author:** [@noetheriankoala](https://discourse.julialang.org/u/noetheriankoala)\
**Replies:** 5\
**Last updated:** [December 8, 2025, 7:36am UTC](https://discourse.julialang.org/t/multithreading-non-contiguous-mapreduction-over-huge-matrices/134413 "2025-12-08T07:36:45Z")

</div>

Hello! A version of the following function is majorly bottle-necking a project I am working on and I could use help speeding it up. In all the below code, A is an k x n matrix, l is a length-n vector, and q is a length n…

---

## [\`@allocated\` vs \`@allocations\`](https://discourse.julialang.org/t/allocated-vs-allocations/134408)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 2\
**Last updated:** [December 7, 2025, 8:36am UTC](https://discourse.julialang.org/t/allocated-vs-allocations/134408 "2025-12-07T08:36:06Z")

</div>

Since 1.9, Julia has @allocations, which is A macro to evaluate an expression, discard the resulting value, and instead return the total number of allocations during evaluation of the expression. In contrast, @alloca…

---

## [Understanding allocations when creating view of nested StructVector](https://discourse.julialang.org/t/understanding-allocations-when-creating-view-of-nested-structvector/134262)

<div class="topic-metadata">

**Author:** [@disberd](https://discourse.julialang.org/u/disberd)\
**Replies:** 1\
**Last updated:** [December 2, 2025, 7:38am UTC](https://discourse.julialang.org/t/understanding-allocations-when-creating-view-of-nested-structvector/134262 "2025-12-02T07:38:35Z")

</div>

Hi everyone, I am trying to wrap my head around why creating a view of a nested StructVector allocates or not depending on the number of fields in the eltype of the StructVector. Could you help me understand why this i…

---

## [Extremely long compilation times in GoogleColab for ModelingToolkit.jl and other Julia packages](https://discourse.julialang.org/t/extremely-long-compilation-times-in-googlecolab-for-modelingtoolkit-jl-and-other-julia-packages/134232)

<div class="topic-metadata">

**Author:** [@JaviJR](https://discourse.julialang.org/u/JaviJR)\
**Replies:** 6\
**Last updated:** [November 30, 2025, 1:37pm UTC](https://discourse.julialang.org/t/extremely-long-compilation-times-in-googlecolab-for-modelingtoolkit-jl-and-other-julia-packages/134232 "2025-11-30T13:37:48Z")

</div>

Hi everyone, I’ve been using ModelingToolkit.jl on Google Colab recently, and I’ve run into a major issue: the compilation time is extremely large. In my case, the first-time compilation of ModelingToolkit took around 3…

---

## [Multi-threading Heisenbug: code is faster when profiled](https://discourse.julialang.org/t/multi-threading-heisenbug-code-is-faster-when-profiled/133805)

<div class="topic-metadata">

**Author:** [@jlbosse](https://discourse.julialang.org/u/jlbosse)\
**Replies:** 5\
**Last updated:** [November 28, 2025, 2:01pm UTC](https://discourse.julialang.org/t/multi-threading-heisenbug-code-is-faster-when-profiled/133805 "2025-11-28T14:01:26Z")

</div>

I have some trivially parallelizable for loops that I wanted to speed up using multi-threading, namely using Folds.jls Folds.foreach(). I started julia with julia -t 8 to get one interactive thread and 8 worker threads a…

---

## [Type Stabled Jacobian of a Hessian](https://discourse.julialang.org/t/type-stabled-jacobian-of-a-hessian/134148)

<div class="topic-metadata">

**Author:** [@JPCAM](https://discourse.julialang.org/u/JPCAM)\
**Replies:** 3\
**Last updated:** [November 28, 2025, 11:41am UTC](https://discourse.julialang.org/t/type-stabled-jacobian-of-a-hessian/134148 "2025-11-28T11:41:28Z")

</div>

I’ve run into a type-stability issue when trying to compute third-order derivatives with ForwardDiff. I have a potential function that takes a vector as input. Computing the Hessian with ForwardDiff.hessian works well a…

---

## [Configuring the VS Code Julia Extension to Use a Custom Terminal Name](https://discourse.julialang.org/t/configuring-the-vs-code-julia-extension-to-use-a-custom-terminal-name/133521)

<div class="topic-metadata">

**Author:** [@askvorts](https://discourse.julialang.org/u/askvorts)\
**Replies:** 1\
**Last updated:** [November 26, 2025, 8:57pm UTC](https://discourse.julialang.org/t/configuring-the-vs-code-julia-extension-to-use-a-custom-terminal-name/133521 "2025-11-26T20:57:54Z")

</div>

Is it possible to configure the VS Code Julia extension to execute code in a terminal session with a name other than the default “Julia REPL (version)”?

---

## [Query compiler's effect modeling](https://discourse.julialang.org/t/query-compilers-effect-modeling/134079)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 2\
**Last updated:** [November 24, 2025, 2:15pm UTC](https://discourse.julialang.org/t/query-compilers-effect-modeling/134079 "2025-11-24T14:15:46Z")

</div>

Before using @assume\_effects, is it possible to check what the compiler already figured out about a function? I can of course do it very indirectly (call the function and see what’s eliminated), but it would be great to…

---

## [Dagger.jl optimising a two step matrix-vector multiplication](https://discourse.julialang.org/t/dagger-jl-optimising-a-two-step-matrix-vector-multiplication/134030)

<div class="topic-metadata">

**Author:** [@cneverett](https://discourse.julialang.org/u/cneverett)\
**Replies:** 1\
**Last updated:** [November 22, 2025, 9:23pm UTC](https://discourse.julialang.org/t/dagger-jl-optimising-a-two-step-matrix-vector-multiplication/134030 "2025-11-22T21:23:30Z")

</div>

Hi All, I am attempting to scale some serial code used in my code package Diplodocus.jl to be compatible with HPC systems, following suggestions to try distributing operations using Dagger.jl. My problem (in serial) is …

---

## [Best practices for optimization problems with ODE solves and eigen calls](https://discourse.julialang.org/t/best-practices-for-optimization-problems-with-ode-solves-and-eigen-calls/133995)

<div class="topic-metadata">

**Author:** [@Gavin-Rockwood](https://discourse.julialang.org/u/Gavin-Rockwood)\
**Replies:** 12\
**Last updated:** [November 21, 2025, 7:47am UTC](https://discourse.julialang.org/t/best-practices-for-optimization-problems-with-ode-solves-and-eigen-calls/133995 "2025-11-21T07:47:22Z")

</div>

I am working on an optimization which has the following structure Build some Hamiltonian large matrices which are functions of the parameters I am optimizing over Project onto the lowest couple of energy levels Calcula…

---

## [Need memory and/or parallel optimization for pairwise distance metrics](https://discourse.julialang.org/t/need-memory-and-or-parallel-optimization-for-pairwise-distance-metrics/133943)

<div class="topic-metadata">

**Author:** [@kevbonham](https://discourse.julialang.org/u/kevbonham)\
**Replies:** 25\
**Last updated:** [November 19, 2025, 8:17pm UTC](https://discourse.julialang.org/t/need-memory-and-or-parallel-optimization-for-pairwise-distance-metrics/133943 "2025-11-19T20:17:51Z")

</div>

I have a ~1000x800,000 sparse matrix, and I would like to calculate pairwise distance metrics for the columns. The vast majority of these will have distance 1, so I thought that I might store them as similarity (1 - dist…

---

## [GEMM kernel, cache oblivious, and Strassen](https://discourse.julialang.org/t/gemm-kernel-cache-oblivious-and-strassen/126527)

<div class="topic-metadata">

**Author:** [@photor](https://discourse.julialang.org/u/photor)\
**Replies:** 5\
**Last updated:** [November 19, 2025, 5:18am UTC](https://discourse.julialang.org/t/gemm-kernel-cache-oblivious-and-strassen/126527 "2025-11-19T05:18:07Z")

</div>

I think many people are curious about how a GEMM kernel written in pure Julia can be much more performant than a naively written one. One can inspect the source code of LoopVectorization.jl, of course, or even the more p…

---

## [Linear Algebra Manipulations with Cholesky Factors](https://discourse.julialang.org/t/linear-algebra-manipulations-with-cholesky-factors/133899)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 1\
**Last updated:** [November 15, 2025, 6:51pm UTC](https://discourse.julialang.org/t/linear-algebra-manipulations-with-cholesky-factors/133899 "2025-11-15T18:51:20Z")

</div>

I’m working on a problem where I need to do some Gaussian random variable sampling, which would naive be implemented as: nx = 10 e = ones(nx) A = spdiagm(-1 =\> -e\[1:end-1\], 0 =\> 2e, 1 =\> -e\[1:end-1\]) chol = cholesky(A, …

---

## [Automatically enable GC during JIT compile](https://discourse.julialang.org/t/automatically-enable-gc-during-jit-compile/133894)

<div class="topic-metadata">

**Author:** [@csvance](https://discourse.julialang.org/u/csvance)\
**Replies:** 2\
**Last updated:** [November 15, 2025, 12:19am UTC](https://discourse.julialang.org/t/automatically-enable-gc-during-jit-compile/133894 "2025-11-15T00:19:39Z")

</div>

To get the best performance for my Julia RPC server in production, I turn off GC during the execution of each request and manually call the GC after returning the response. Each Julia RPC server process only handles one …

---

## [Stochastic Gradient Descent (SGD) in julia?](https://discourse.julialang.org/t/stochastic-gradient-descent-sgd-in-julia/133846)

<div class="topic-metadata">

**Author:** [@Sigmund](https://discourse.julialang.org/u/Sigmund)\
**Replies:** 3\
**Last updated:** [November 13, 2025, 12:18pm UTC](https://discourse.julialang.org/t/stochastic-gradient-descent-sgd-in-julia/133846 "2025-11-13T12:18:38Z")

</div>

Im trying to run the newest version of OptimizationManopt.jl together with NeuralPDE.jl. When trying to add NeuralPDE.jl to the environment i get a long stacktrace with unsatisfiable requirements. When adding both to an …

---

## [Understanding "random" serialization when using @spawn in a "parallel region"](https://discourse.julialang.org/t/understanding-random-serialization-when-using-spawn-in-a-parallel-region/133824)

<div class="topic-metadata">

**Author:** [@mmesiti](https://discourse.julialang.org/u/mmesiti)\
**Replies:** 11\
**Last updated:** [November 13, 2025, 11:59am UTC](https://discourse.julialang.org/t/understanding-random-serialization-when-using-spawn-in-a-parallel-region/133824 "2025-11-13T11:59:50Z")

</div>

I have some Julia (1.10.10) code that I am benchmarking on a HPC cluster node with 76 physical cores, running with 76 threads, and I am seeing HUGE variability between runs with everything equal (same hardware, same code…

---

## [\`rand(::MyType, N)\` allocates a lot, how to define return type properly?](https://discourse.julialang.org/t/rand-mytype-n-allocates-a-lot-how-to-define-return-type-properly/133807)

<div class="topic-metadata">

**Author:** [@tamasgal](https://discourse.julialang.org/u/tamasgal)\
**Replies:** 4\
**Last updated:** [November 12, 2025, 1:19pm UTC](https://discourse.julialang.org/t/rand-mytype-n-allocates-a-lot-how-to-define-return-type-properly/133807 "2025-11-12T13:19:48Z")

</div>

Apologies if this has been discussed before but I am a bit lost in the docs and examples out there regarding a type-safe implementation of a proper rand interface. I guess it’s OK to have yet another another topic on thi…

---

## [Backup 1 line when using readline()](https://discourse.julialang.org/t/backup-1-line-when-using-readline/133826)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 1\
**Last updated:** [November 12, 2025, 12:38pm UTC](https://discourse.julialang.org/t/backup-1-line-when-using-readline/133826 "2025-11-12T12:38:16Z")

</div>

I am going through a mixed binary/ASCII file implementing UFF58b file format in UFFFiles.jl. It will make my life easier if I can read a line using readline(), call a subroutine and then read the same line again. So I …

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

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