# Performance

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

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

**Page:** 42

---

## [Minimizing PythonCall overhead with BenchmarkTools](https://discourse.julialang.org/t/minimizing-pythoncall-overhead-with-benchmarktools/100067)

<div class="topic-metadata">

**Author:** [@gdalle](https://discourse.julialang.org/u/gdalle)\
**Replies:** 4\
**Last updated:** [June 9, 2023, 7:57am UTC](https://discourse.julialang.org/t/minimizing-pythoncall-overhead-with-benchmarktools/100067 "2023-06-09T07:57:32Z")

</div>

Hi there! I’m generating benchmarks with BenchmarkTools.jl, where a Python package is called with PythonCall.jl. My question is the following: how can I minimize the overhead of calling a method meth from a Python objec…

---

## [VSCode server weirdly slow in SSH](https://discourse.julialang.org/t/vscode-server-weirdly-slow-in-ssh/99960)

<div class="topic-metadata">

**Author:** [@wujinq](https://discourse.julialang.org/u/wujinq)\
**Replies:** 1\
**Last updated:** [June 8, 2023, 2:35am UTC](https://discourse.julialang.org/t/vscode-server-weirdly-slow-in-ssh/99960 "2023-06-08T02:35:04Z")

</div>

I’m currently using the vscode Julia extension when working remotely on Frontera, a supercomputer (CentOS 7). Recently the extension becomes weirdly slow; when I try to execute a code block, it takes about 1 minute to st…

---

## [Using ntuple() in generated function](https://discourse.julialang.org/t/using-ntuple-in-generated-function/100020)

<div class="topic-metadata">

**Author:** [@user664303](https://discourse.julialang.org/u/user664303)\
**Replies:** 5\
**Last updated:** [June 8, 2023, 12:48am UTC](https://discourse.julialang.org/t/using-ntuple-in-generated-function/100020 "2023-06-08T00:48:47Z")

</div>

I have found that using ntuple in generated functions produces better code (faster, and with fewer allocations), than constructing the tuple expression manually. Presumably the code that ntuple generates is more inferabl…

---

## [Optimal column to row major conversion](https://discourse.julialang.org/t/optimal-column-to-row-major-conversion/99989)

<div class="topic-metadata">

**Author:** [@xgdgsc](https://discourse.julialang.org/u/xgdgsc)\
**Replies:** 7\
**Last updated:** [June 7, 2023, 11:10pm UTC](https://discourse.julialang.org/t/optimal-column-to-row-major-conversion/99989 "2023-06-07T23:10:56Z")

</div>

When converting column major to row major array. When the array dimension become large. It can be tricky to implement fast conversion. Tricks like ENH: Improve performance for copying/relayout of large data · Issue #2165…

---

## [Speed-up graphical lasso code](https://discourse.julialang.org/t/speed-up-graphical-lasso-code/100024)

<div class="topic-metadata">

**Author:** [@mleprovost](https://discourse.julialang.org/u/mleprovost)\
**Replies:** 0\
**Last updated:** [June 7, 2023, 10:09pm UTC](https://discourse.julialang.org/t/speed-up-graphical-lasso-code/100024 "2023-06-07T22:09:53Z")

</div>

Hello, I would like to get you feedback to accelerate my routine glasso for graphical lasso computation (the code follows Friedman et al. 2007 https://arxiv.org/pdf/0708.3517.pdf) where S is the sample covariance matr…

---

## [GPU specifications -- what's the best GPU choice for diffeqGPUs?](https://discourse.julialang.org/t/gpu-specifications-whats-the-best-gpu-choice-for-diffeqgpus/99945)

<div class="topic-metadata">

**Author:** [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)\
**Replies:** 9\
**Last updated:** [June 7, 2023, 5:24pm UTC](https://discourse.julialang.org/t/gpu-specifications-whats-the-best-gpu-choice-for-diffeqgpus/99945 "2023-06-07T17:24:58Z")

</div>

I’m looking out specifying a cluster for our IT guys. I’m not a GPU guru and am not up to date on all of the choices. I see there are a lot of options and some GPUs are more optimized for machine learning, etc. I’d li…

---

## [How does \`--heap\_size\_hint\` relate to improvements for \`Sys.total\_memory()\`?](https://discourse.julialang.org/t/how-does-heap-size-hint-relate-to-improvements-for-sys-total-memory/100006)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 0\
**Last updated:** [June 7, 2023, 2:46pm UTC](https://discourse.julialang.org/t/how-does-heap-size-hint-relate-to-improvements-for-sys-total-memory/100006 "2023-06-07T14:46:27Z")

</div>

Hi there, I am looking to make Julia run smoothly on a kubernetes pod. There seem to be two things which somehow improve stability: Expose constrained memory limits and have the GC use them by maleadt · Pull Request …

---

## [Faster/performant interpolation of very big arrays](https://discourse.julialang.org/t/faster-performant-interpolation-of-very-big-arrays/99996)

<div class="topic-metadata">

**Author:** [@eirikeb](https://discourse.julialang.org/u/eirikeb)\
**Replies:** 0\
**Last updated:** [June 7, 2023, 11:49am UTC](https://discourse.julialang.org/t/faster-performant-interpolation-of-very-big-arrays/99996 "2023-06-07T11:49:34Z")

</div>

I have two separate problems relating to interpolation of some dimensions of relatively big arrays. Creating interpolations objects using \`Interpolations.jl’ is a little slow and uses a lot of memory when you create a …

---

## [Is it possible to tune garbage collection for interactivity?](https://discourse.julialang.org/t/is-it-possible-to-tune-garbage-collection-for-interactivity/99841)

<div class="topic-metadata">

**Author:** [@jules](https://discourse.julialang.org/u/jules)\
**Replies:** 6\
**Last updated:** [June 6, 2023, 2:41pm UTC](https://discourse.julialang.org/t/is-it-possible-to-tune-garbage-collection-for-interactivity/99841 "2023-06-06T14:41:47Z")

</div>

200-300 ms intervals of gc are very disruptive when interacting with plots in GLMakie, for example. It would be much better if GC ran more often but only for 5ms or so at a time so that the chance of dropping frames is l…

---

## [Inference in nested quadgk](https://discourse.julialang.org/t/inference-in-nested-quadgk/99937)

<div class="topic-metadata">

**Author:** [@lxvm](https://discourse.julialang.org/u/lxvm)\
**Replies:** 0\
**Last updated:** [June 6, 2023, 1:11pm UTC](https://discourse.julialang.org/t/inference-in-nested-quadgk/99937 "2023-06-06T13:11:48Z")

</div>

There have been a handful of threads on this forum regarding long compilation times for nested quadgk calls (e.g. here) and I was wondering what are some of the possible reasons that type inference may be failing in this…

---

## [Julia v1.8 -\> v1.9 makes this code 1000x slower](https://discourse.julialang.org/t/julia-v1-8-v1-9-makes-this-code-1000x-slower/99766)

<div class="topic-metadata">

**Author:** [@user664303](https://discourse.julialang.org/u/user664303)\
**Replies:** 6\
**Last updated:** [June 6, 2023, 12:55pm UTC](https://discourse.julialang.org/t/julia-v1-8-v1-9-makes-this-code-1000x-slower/99766 "2023-06-06T12:55:52Z")

</div>

On upgrading to Julia from 1.8.5. to 1.9.0 I noticed code in one of my packages slow down significantly. It has taken me a long time to get down to the simplest code which replicates the problem, but I have it now. After…

---

## [Generate function that calls sequence of functions in order to avoid recompilation](https://discourse.julialang.org/t/generate-function-that-calls-sequence-of-functions-in-order-to-avoid-recompilation/99919)

<div class="topic-metadata">

**Author:** [@heindelj](https://discourse.julialang.org/u/heindelj)\
**Replies:** 3\
**Last updated:** [June 6, 2023, 12:21pm UTC](https://discourse.julialang.org/t/generate-function-that-calls-sequence-of-functions-in-order-to-avoid-recompilation/99919 "2023-06-06T12:21:55Z")

</div>

I have a type which looks like this: mutable struct FQCTDipole{T\<:Function} \<: AbstractForceField terms::Vector{T} storage::FQCTDipoleStorage results::ForceFieldResults end The only part of this that matter…

---

## [Disappointing benchmark results with AMD Threadripper PRO 3975WX 32 Cores](https://discourse.julialang.org/t/disappointing-benchmark-results-with-amd-threadripper-pro-3975wx-32-cores/99806)

<div class="topic-metadata">

**Author:** [@albertomercurio](https://discourse.julialang.org/u/albertomercurio)\
**Replies:** 10\
**Last updated:** [June 6, 2023, 8:22am UTC](https://discourse.julialang.org/t/disappointing-benchmark-results-with-amd-threadripper-pro-3975wx-32-cores/99806 "2023-06-06T08:22:16Z")

</div>

Hello, I have the Lenovo ThinkStation P620 with the AMD Threadripper PRO 3975WX with 32 cores and 64 Threads. I installed Ubuntu 22.04.2, and I noticed that the performances are not so much improved with respect for exa…

---

## [Rollsum/cumulative optimisation](https://discourse.julialang.org/t/rollsum-cumulative-optimisation/99718)

<div class="topic-metadata">

**Author:** [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Replies:** 12\
**Last updated:** [June 5, 2023, 11:36am UTC](https://discourse.julialang.org/t/rollsum-cumulative-optimisation/99718 "2023-06-05T11:36:53Z")

</div>

Hi, I was wondering if someone can help me speed up the below function (roll\_sum) in anyway? (Multi-threading, better algorithm,…etc). An easy way would be to remove the copy but I have added it so it is easy to benchm…

---

## [Error when processing data from file for linear regression](https://discourse.julialang.org/t/error-when-processing-data-from-file-for-linear-regression/99824)

<div class="topic-metadata">

**Author:** [@Leticia-maria](https://discourse.julialang.org/u/Leticia-maria)\
**Replies:** 7\
**Last updated:** [June 5, 2023, 6:22am UTC](https://discourse.julialang.org/t/error-when-processing-data-from-file-for-linear-regression/99824 "2023-06-05T06:22:46Z")

</div>

Dear all, I am trying to run the following code: I extract the data from a Matlab file I split train/test I try to run linear regression the following issues: I wanna reduce allocations I wanna make It faster usin…

---

## [Learning Julia by an example of a simple Bayesian linear regression](https://discourse.julialang.org/t/learning-julia-by-an-example-of-a-simple-bayesian-linear-regression/99811)

<div class="topic-metadata">

**Author:** [@Boris](https://discourse.julialang.org/u/Boris)\
**Replies:** 10\
**Last updated:** [June 4, 2023, 8:58pm UTC](https://discourse.julialang.org/t/learning-julia-by-an-example-of-a-simple-bayesian-linear-regression/99811 "2023-06-04T20:58:49Z")

</div>

Hello everyone, long-time lurker, very occasional poster. I decided to give Julia a try once more with 1.9. So far I have struggled with the language on and off (I have touched on this previously) but would really like …

---

## [Time to create Union of types in Julia 1.9.0 vs Julia 1.8.5](https://discourse.julialang.org/t/time-to-create-union-of-types-in-julia-1-9-0-vs-julia-1-8-5/99712)

<div class="topic-metadata">

**Author:** [@mtyogi](https://discourse.julialang.org/u/mtyogi)\
**Replies:** 4\
**Last updated:** [June 2, 2023, 6:38am UTC](https://discourse.julialang.org/t/time-to-create-union-of-types-in-julia-1-9-0-vs-julia-1-8-5/99712 "2023-06-02T06:38:35Z")

</div>

Version info Julia installation. Updated v1.8.5 to v1.9.0 as follows: \]add UpdateJulia using UpdateJulia update\_julia() Issue Julia Version 1.8.5 Commit 17cfb8e65e (2023-01-08 06:45 UTC) Platform Info: OS: Windows…

---

## [Hard Disk storage solution for a (large) array of matrices](https://discourse.julialang.org/t/hard-disk-storage-solution-for-a-large-array-of-matrices/99734)

<div class="topic-metadata">

**Author:** [@Mouad](https://discourse.julialang.org/u/Mouad)\
**Replies:** 12\
**Last updated:** [June 1, 2023, 9:33pm UTC](https://discourse.julialang.org/t/hard-disk-storage-solution-for-a-large-array-of-matrices/99734 "2023-06-01T21:33:02Z")

</div>

I just finished an enormous scientific simulation (billions of regressions, trillions of allocations). The final output are a few arrays of matrices: 100000-element Vector{Matrix{Float64}}. I am looking for a solution t…

---

## [How to achieve good performance with Zygote.pushforward on a neural network](https://discourse.julialang.org/t/how-to-achieve-good-performance-with-zygote-pushforward-on-a-neural-network/55971)

<div class="topic-metadata">

**Author:** [@de-souza](https://discourse.julialang.org/u/de-souza)\
**Replies:** 3\
**Last updated:** [May 31, 2023, 3:21pm UTC](https://discourse.julialang.org/t/how-to-achieve-good-performance-with-zygote-pushforward-on-a-neural-network/55971 "2023-05-31T15:21:57Z")

</div>

Hello, I am trying to implement a neural network with a loss function that contains a derivative of the network with regards to its input. To be able to use Flux to update the weights of the network, the loss function …

---

## [Inside closures, captured constructors are much slower than captured functions](https://discourse.julialang.org/t/inside-closures-captured-constructors-are-much-slower-than-captured-functions/99638)

<div class="topic-metadata">

**Author:** [@matthias314](https://discourse.julialang.org/u/matthias314)\
**Replies:** 2\
**Last updated:** [May 31, 2023, 12:47pm UTC](https://discourse.julialang.org/t/inside-closures-captured-constructors-are-much-slower-than-captured-functions/99638 "2023-05-31T12:47:54Z")

</div>

I have noticed that inside function closures, using a captured variable with a type value as a constructor is much slower than using a variable with a function value. Consider the following (silly) example: function g(f…

---

## [How to correctly design multi-thread cache that's transparent to user iteration?](https://discourse.julialang.org/t/how-to-correctly-design-multi-thread-cache-thats-transparent-to-user-iteration/99577)

<div class="topic-metadata">

**Author:** [@jling](https://discourse.julialang.org/u/jling)\
**Replies:** 10\
**Last updated:** [May 31, 2023, 7:18am UTC](https://discourse.julialang.org/t/how-to-correctly-design-multi-thread-cache-thats-transparent-to-user-iteration/99577 "2023-05-31T07:18:16Z")

</div>

Runnable code and benchmark at this gist. This is a widespread pattern for columnar-storage access, usually each column is too large to fit in ram, so it’s chunked in to clusters, and each cluster is individually compre…

---

## [Improvements for solving an ODE "piecewise"](https://discourse.julialang.org/t/improvements-for-solving-an-ode-piecewise/99626)

<div class="topic-metadata">

**Author:** [@dnldlg](https://discourse.julialang.org/u/dnldlg)\
**Replies:** 1\
**Last updated:** [May 30, 2023, 7:55pm UTC](https://discourse.julialang.org/t/improvements-for-solving-an-ode-piecewise/99626 "2023-05-30T19:55:19Z")

</div>

Consider the following problem: I have a linear ODE x' = M(t) x, but at some times t\_i during the integration interval I need to apply some operation on the current state, i.e x\_\\text{new}(t\_i) = A \\cdot x(t). A little …

---

## [Should I add type annotation to keyword arguments?](https://discourse.julialang.org/t/should-i-add-type-annotation-to-keyword-arguments/99231)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 10\
**Last updated:** [May 30, 2023, 1:32am UTC](https://discourse.julialang.org/t/should-i-add-type-annotation-to-keyword-arguments/99231 "2023-05-30T01:32:17Z")

</div>

Old versions of Julia’s performance tips https://docs.julialang.org/en/v1/manual/performance-tips advised annotating the types of keyword arguments, but this is no longer mentioned in the current version. Do I still ne…

---

## [Help Requested: Understanding cause of allocations for dynamic dispatch returning \`nothing\`, which vary based on argument type](https://discourse.julialang.org/t/help-requested-understanding-cause-of-allocations-for-dynamic-dispatch-returning-nothing-which-vary-based-on-argument-type/99517)

<div class="topic-metadata">

**Author:** [@NHDaly](https://discourse.julialang.org/u/NHDaly)\
**Replies:** 6\
**Last updated:** [May 29, 2023, 3:23pm UTC](https://discourse.julialang.org/t/help-requested-understanding-cause-of-allocations-for-dynamic-dispatch-returning-nothing-which-vary-based-on-argument-type/99517 "2023-05-29T15:23:39Z")

</div>

Can someone help me understand why passing a Ptr{UInt} to this dynamic dispatch leads to allocations, whereas passing a Ref{UInt} does not? I have tried the Allocation Profiler, Cthulhu, and @code\_\*, and I can’t figure …

---

## [Why mul! does not work with a target that has more columns than the result?](https://discourse.julialang.org/t/why-mul-does-not-work-with-a-target-that-has-more-columns-than-the-result/99531)

<div class="topic-metadata">

**Author:** [@pitsianis](https://discourse.julialang.org/u/pitsianis)\
**Replies:** 2\
**Last updated:** [May 28, 2023, 11:35pm UTC](https://discourse.julialang.org/t/why-mul-does-not-work-with-a-target-that-has-more-columns-than-the-result/99531 "2023-05-28T23:35:17Z")

</div>

I was surprised to find that mul! in C = zeros(4,6); A = rand(4,3); B = rand(3,5); mul!(C, A, B); fails with ERROR: DimensionMismatch: A has size (4,3), B has size (3,5), C has size (4, 6) instead of proceeding by ov…

---

## [DiffEqFlux and Threaded Ensemble Problems with ForwardDiff](https://discourse.julialang.org/t/diffeqflux-and-threaded-ensemble-problems-with-forwarddiff/99514)

<div class="topic-metadata">

**Author:** [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)\
**Replies:** 3\
**Last updated:** [May 28, 2023, 6:48pm UTC](https://discourse.julialang.org/t/diffeqflux-and-threaded-ensemble-problems-with-forwarddiff/99514 "2023-05-28T18:48:55Z")

</div>

Hi Julia Speed Guru’s, I’m trying to demonstrate Julia’s cool capabilities for embedding shallow neural networks to select key parameters for an ensemble of differential equations. I can use the ensemble problem fine a…

---

## [Julia 1.9 uses more memory for compilation caches that 1.8](https://discourse.julialang.org/t/julia-1-9-uses-more-memory-for-compilation-caches-that-1-8/99482)

<div class="topic-metadata">

**Author:** [@andreyz4k](https://discourse.julialang.org/u/andreyz4k)\
**Replies:** 9\
**Last updated:** [May 28, 2023, 4:42pm UTC](https://discourse.julialang.org/t/julia-1-9-uses-more-memory-for-compilation-caches-that-1-8/99482 "2023-05-28T16:42:05Z")

</div>

Hi, I have a fairly large project that has a number of functions that deal with parameters of unspecified type (mostly passing them to the next functions that know what they will be getting). In the end, I’m relying on r…

---

## [Efficient pushforward (Jacobian vector product) with multiple vectors using automatic differentiation](https://discourse.julialang.org/t/efficient-pushforward-jacobian-vector-product-with-multiple-vectors-using-automatic-differentiation/99408)

<div class="topic-metadata">

**Author:** [@cadaverous](https://discourse.julialang.org/u/cadaverous)\
**Replies:** 13\
**Last updated:** [May 27, 2023, 1:18am UTC](https://discourse.julialang.org/t/efficient-pushforward-jacobian-vector-product-with-multiple-vectors-using-automatic-differentiation/99408 "2023-05-27T01:18:44Z")

</div>

Hello! I have written some code that computes the pushforward of a time-stepping function with multiple vectors: julia\> function my\_step\_pushforward!(u, Ψ, Δt) rank = size(Ψ)\[2\] # Ψ is an n X rank matrix …

---

## [Performance costs associated with using local variable bindings](https://discourse.julialang.org/t/performance-costs-associated-with-using-local-variable-bindings/99465)

<div class="topic-metadata">

**Author:** [@qua4tre](https://discourse.julialang.org/u/qua4tre)\
**Replies:** 1\
**Last updated:** [May 26, 2023, 9:35pm UTC](https://discourse.julialang.org/t/performance-costs-associated-with-using-local-variable-bindings/99465 "2023-05-26T21:35:53Z")

</div>

Is there any impact on performance of a function from using local variable bindings for convenience and readability? For example, function foo(x) a,b = x\[1:2\] return a^2 + b^2 end vs function bar(x) retur…

---

## [Custom rule for differentiating through Newton solver using ForwardDiff: works for gradient, fails for hessian](https://discourse.julialang.org/t/custom-rule-for-differentiating-through-newton-solver-using-forwarddiff-works-for-gradient-fails-for-hessian/93002)

<div class="topic-metadata">

**Author:** [@touste](https://discourse.julialang.org/u/touste)\
**Replies:** 23\
**Last updated:** [May 26, 2023, 5:31pm UTC](https://discourse.julialang.org/t/custom-rule-for-differentiating-through-newton-solver-using-forwarddiff-works-for-gradient-fails-for-hessian/93002 "2023-05-26T17:31:05Z")

</div>

Hi all, I have a function obj(p) that solves for the parameter t of a Bezier curve B(t) so that the arclength is equal to some arbitrary value (2 in this kind-of-minimal example). It uses the Newton’s method. The Bezie…

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

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