# Performance

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

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

**Page:** 45

---

## [Iterating over range is slower than while loop](https://discourse.julialang.org/t/iterating-over-range-is-slower-than-while-loop/96991)

<div class="topic-metadata">

**Author:** [@Zentrik](https://discourse.julialang.org/u/Zentrik)\
**Replies:** 7\
**Last updated:** [April 24, 2023, 4:10pm UTC](https://discourse.julialang.org/t/iterating-over-range-is-slower-than-while-loop/96991 "2023-04-24T16:10:14Z")

</div>

using BenchmarkTools, SIMD function test(x) N = 8 c = Vec{N, Float32}(0) lane = VecRange{N}(0) @inbounds @fastmath for i in 1:N:length(x) c += x\[lane + i\] end return sum(c) end functio…

---

## [Flux Restructure for ComponentArrays.jl unreasonably slow](https://discourse.julialang.org/t/flux-restructure-for-componentarrays-jl-unreasonably-slow/97849)

<div class="topic-metadata">

**Author:** [@glatteis](https://discourse.julialang.org/u/glatteis)\
**Replies:** 2\
**Last updated:** [April 24, 2023, 12:56pm UTC](https://discourse.julialang.org/t/flux-restructure-for-componentarrays-jl-unreasonably-slow/97849 "2023-04-24T12:56:18Z")

</div>

In some situations, you have to restructure a lot if you use Flux and want to run your batches as seperate solves, not as one big solve, for instance using an EnsembleProblem. You have to use something like a ComponentAr…

---

## [Are there any more-readable alternatives to using many individual variables for performance critical code?](https://discourse.julialang.org/t/are-there-any-more-readable-alternatives-to-using-many-individual-variables-for-performance-critical-code/97820)

<div class="topic-metadata">

**Author:** [@Qile0317](https://discourse.julialang.org/u/Qile0317)\
**Replies:** 8\
**Last updated:** [April 24, 2023, 12:45pm UTC](https://discourse.julialang.org/t/are-there-any-more-readable-alternatives-to-using-many-individual-variables-for-performance-critical-code/97820 "2023-04-24T12:45:57Z")

</div>

For a package I’ve been developing in which the code performance is critical, many functions utilize a very long list of individual variables, both arguments and internal variables alike. I’ve tried in the past to modify…

---

## [Julia Threads.@threads slower than single thread performance](https://discourse.julialang.org/t/julia-threads-threads-slower-than-single-thread-performance/46823)

<div class="topic-metadata">

**Author:** [@cricci](https://discourse.julialang.org/u/cricci)\
**Replies:** 11\
**Last updated:** [April 24, 2023, 8:57am UTC](https://discourse.julialang.org/t/julia-threads-threads-slower-than-single-thread-performance/46823 "2023-04-24T08:57:11Z")

</div>

I am trying to solve numerically the heat equation in 1d: I am using finite differences and I have some trouble using the @threads instruction in Julia. In particular below there are two version of the same code: the …

---

## [Why I still recommend Julia: how 300 lines of Julia code being 1000x faster than MATLAB's C Mex codes](https://discourse.julialang.org/t/why-i-still-recommend-julia-how-300-lines-of-julia-code-being-1000x-faster-than-matlabs-c-mex-codes/97842)

<div class="topic-metadata">

**Author:** [@JohnnyChen94](https://discourse.julialang.org/u/JohnnyChen94)\
**Replies:** 1\
**Last updated:** [April 24, 2023, 7:43am UTC](https://discourse.julialang.org/t/why-i-still-recommend-julia-how-300-lines-of-julia-code-being-1000x-faster-than-matlabs-c-mex-codes/97842 "2023-04-24T07:43:11Z")

</div>

I believe this is an excellent real-world example to showcase Julia’s superiority. GaloisFieldNumbers is a reference (snapshotted) implementation that shows the beauty of Julia in 300 lines of code. It was released a fe…

---

## [Working with different versions of Julia](https://discourse.julialang.org/t/working-with-different-versions-of-julia/97573)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 6\
**Last updated:** [April 23, 2023, 8:46pm UTC](https://discourse.julialang.org/t/working-with-different-versions-of-julia/97573 "2023-04-23T20:46:12Z")

</div>

Under normal circumstances, I work with a single version of Julia, say, Julia 1.8. I have a folder of Julia code, along with Project.toml and Manifest.toml files. I would also like to work with Julia 1.9. What is the str…

---

## [Simd and dot vectorization](https://discourse.julialang.org/t/simd-and-dot-vectorization/97817)

<div class="topic-metadata">

**Author:** [@dmbates](https://discourse.julialang.org/u/dmbates)\
**Replies:** 1\
**Last updated:** [April 23, 2023, 5:54pm UTC](https://discourse.julialang.org/t/simd-and-dot-vectorization/97817 "2023-04-23T17:54:51Z")

</div>

Does dot vectorization use SIMD explicitly or implicitly? If I look at the LLVM code for a function call to ‘myadd!’ in julia\> myadd(x, y) = x + y myadd (generic function with 1 method) julia\> function myadd!(z::Vecto…

---

## [Optimizing function barrier for mapreduce](https://discourse.julialang.org/t/optimizing-function-barrier-for-mapreduce/97795)

<div class="topic-metadata">

**Author:** [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Replies:** 2\
**Last updated:** [April 22, 2023, 7:47pm UTC](https://discourse.julialang.org/t/optimizing-function-barrier-for-mapreduce/97795 "2023-04-22T19:47:47Z")

</div>

I have a function that counts the number of nodes in a binary tree: struct Node degree::Int l::Node r::Node # possibly undefined; assume degree is correct Node(::Int) = new(0) Node(::Int, l::Node) =…

---

## [Metal throws ERROR: Exception handler triggered on unmanaged thread](https://discourse.julialang.org/t/metal-throws-error-exception-handler-triggered-on-unmanaged-thread/97727)

<div class="topic-metadata">

**Author:** [@pitsianis](https://discourse.julialang.org/u/pitsianis)\
**Replies:** 2\
**Last updated:** [April 21, 2023, 3:07pm UTC](https://discourse.julialang.org/t/metal-throws-error-exception-handler-triggered-on-unmanaged-thread/97727 "2023-04-21T15:07:49Z")

</div>

This is my very first try to use the M2 GPU using the 1.9-rc2 aa64. The following implements a straight forward imperative bitonic sort. However, when running from the REPL, from time to time, it throws ERROR: Exception…

---

## [HTTP.jl async is slow compared to python+aiohttp](https://discourse.julialang.org/t/http-jl-async-is-slow-compared-to-python-aiohttp/96736)

<div class="topic-metadata">

**Author:** [@agoodm](https://discourse.julialang.org/u/agoodm)\
**Replies:** 48\
**Last updated:** [April 21, 2023, 4:52am UTC](https://discourse.julialang.org/t/http-jl-async-is-slow-compared-to-python-aiohttp/96736 "2023-04-21T04:52:19Z")

</div>

So @fabiangans and I have been having discussions about improving the performance of Zarr.jl. The goal is to improve the time it takes to load data from a remote zarr store (eg on HTTP, GCS, or S3). The current implement…

---

## [What is StrideArrays.jl](https://discourse.julialang.org/t/what-is-stridearrays-jl/97146)

<div class="topic-metadata">

**Author:** [@torrance](https://discourse.julialang.org/u/torrance)\
**Replies:** 26\
**Last updated:** [April 20, 2023, 12:01pm UTC](https://discourse.julialang.org/t/what-is-stridearrays-jl/97146 "2023-04-20T12:01:03Z")

</div>

It’s an odd question to ask, but I see StrideArrays.jl being used in a lot of extremely performance critical code, but meanwhile the documentation of the project… leaves a lot to be desired. So: what is StrideArrays.jl?…

---

## [Cubic Spline Interpolation for unevenly sampled data with gradient support?](https://discourse.julialang.org/t/cubic-spline-interpolation-for-unevenly-sampled-data-with-gradient-support/89794)

<div class="topic-metadata">

**Author:** [@astrobc1](https://discourse.julialang.org/u/astrobc1)\
**Replies:** 1\
**Last updated:** [April 19, 2023, 9:27pm UTC](https://discourse.julialang.org/t/cubic-spline-interpolation-for-unevenly-sampled-data-with-gradient-support/89794 "2023-04-19T21:27:25Z")

</div>

I’m trying to use Flux.jl to optimize a loss function that needs to perform cubic spline interpolation, so I need a package that includes gradient support. Right now I’m working with DataInterpolations.jl. So far I have …

---

## [Using stiff solvers for a large system of ode](https://discourse.julialang.org/t/using-stiff-solvers-for-a-large-system-of-ode/97626)

<div class="topic-metadata">

**Author:** [@UgoMire](https://discourse.julialang.org/u/UgoMire)\
**Replies:** 3\
**Last updated:** [April 18, 2023, 7:25pm UTC](https://discourse.julialang.org/t/using-stiff-solvers-for-a-large-system-of-ode/97626 "2023-04-18T19:25:49Z")

</div>

Hi, I am trying to solve the following set of partial differential equation: \\begin{cases} \\partial\_t u(x, y, t) = \\partial\_x f(x, y, t, u, \\partial\_x u) \\\\ \\partial\_t v(x, y, t) = \\partial\_y f(x, y, t, u, \\partial\_x …

---

## [Multi-threading for nested loops with inner loop collection depending on outer loop](https://discourse.julialang.org/t/multi-threading-for-nested-loops-with-inner-loop-collection-depending-on-outer-loop/97569)

<div class="topic-metadata">

**Author:** [@liuyxpp](https://discourse.julialang.org/u/liuyxpp)\
**Replies:** 7\
**Last updated:** [April 18, 2023, 12:25pm UTC](https://discourse.julialang.org/t/multi-threading-for-nested-loops-with-inner-loop-collection-depending-on-outer-loop/97569 "2023-04-18T12:25:25Z")

</div>

What is the most efficient way to parallelize an embarrassingly parallel problem with nested loops, while the inner loop’s collection depending on outer loop? MWE is using Base.Threads using ThreadsX using FLoops xs = …

---

## [Memory Allocation Increases with Iterations](https://discourse.julialang.org/t/memory-allocation-increases-with-iterations/97532)

<div class="topic-metadata">

**Author:** [@GeoKou](https://discourse.julialang.org/u/GeoKou)\
**Replies:** 15\
**Last updated:** [April 18, 2023, 12:18pm UTC](https://discourse.julialang.org/t/memory-allocation-increases-with-iterations/97532 "2023-04-18T12:18:38Z")

</div>

Hello, I have a function that generates a number of graphs to extract some features from each, in a for loop. Since the graph is created and the features are extracted, its information is not needed in the next iteratio…

---

## [Help me beat Lsoda](https://discourse.julialang.org/t/help-me-beat-lsoda/88236)

<div class="topic-metadata">

**Author:** [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Replies:** 26\
**Last updated:** [April 17, 2023, 4:54pm UTC](https://discourse.julialang.org/t/help-me-beat-lsoda/88236 "2023-04-17T16:54:29Z")

</div>

Hi, I want to simulate a Jump process for biological applications quite precisely and fast. I developped a package PiecewiseDeterministicMarkovProcesses.jl based on DifferentialEquations.jl to simulate these jump proces…

---

## [UUID in Project.toml](https://discourse.julialang.org/t/uuid-in-project-toml/97576)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 2\
**Last updated:** [April 17, 2023, 3:42pm UTC](https://discourse.julialang.org/t/uuid-in-project-toml/97576 "2023-04-17T15:42:59Z")

</div>

In a Project.toml files, the structure is a series of rows containing Module name and UUID. For example: \[deps\] ArgMacros = "dbc42088-9de8-42a0-8ec8-2cd114e1ea3e" BSON = "fbb218c0-5317-5bc6-957e-2ee96dd4b1f0" BenchmarkT…

---

## [MKL Distributed slower！](https://discourse.julialang.org/t/mkl-distributed-slower/97561)

<div class="topic-metadata">

**Author:** [@13299118606](https://discourse.julialang.org/u/13299118606)\
**Replies:** 2\
**Last updated:** [April 17, 2023, 10:21am UTC](https://discourse.julialang.org/t/mkl-distributed-slower/97561 "2023-04-17T10:21:06Z")

</div>

I am using MKL to accelerate svd, using MKL svd will be 5-10 times faster But it is far from enough in parallel: Add the original svd 1.3s using mkl will change to 0.15s Then parallel each time 0.6s If I declare i…

---

## [Julia 1.9 vs. 1.8 performance for comprehension and splatting?](https://discourse.julialang.org/t/julia-1-9-vs-1-8-performance-for-comprehension-and-splatting/97521)

<div class="topic-metadata">

**Author:** [@greatpet](https://discourse.julialang.org/u/greatpet)\
**Replies:** 0\
**Last updated:** [April 15, 2023, 8:00pm UTC](https://discourse.julialang.org/t/julia-1-9-vs-1-8-performance-for-comprehension-and-splatting/97521 "2023-04-15T20:00:04Z")

</div>

Julia 1.9 seems to be slower than 1.8 for some comprehension and splatting code. Here’s a minimal working example. I’ve written functions for doubling the values of a dictionary, including a “normal” version involving a …

---

## [Why is a staggering 30% of the CPU profile not accounted for?](https://discourse.julialang.org/t/why-is-a-staggering-30-of-the-cpu-profile-not-accounted-for/97478)

<div class="topic-metadata">

**Author:** [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Replies:** 2\
**Last updated:** [April 15, 2023, 10:23am UTC](https://discourse.julialang.org/t/why-is-a-staggering-30-of-the-cpu-profile-not-accounted-for/97478 "2023-04-15T10:23:42Z")

</div>

How come that 30% (on the right-hand side) of the CPU performance profile here is not accounted for? This is in the preview version of the (VS) Code Julia extension, with Julia 1.9.0-rc2, on Linux. This seems reprod…

---

## [Several second delay to process first input with OhMyREPL installed](https://discourse.julialang.org/t/several-second-delay-to-process-first-input-with-ohmyrepl-installed/97447)

<div class="topic-metadata">

**Author:** [@pitsianis](https://discourse.julialang.org/u/pitsianis)\
**Replies:** 4\
**Last updated:** [April 14, 2023, 4:58pm UTC](https://discourse.julialang.org/t/several-second-delay-to-process-first-input-with-ohmyrepl-installed/97447 "2023-04-14T16:58:01Z")

</div>

Running Julia 1.8.5 x86, built by Homebrew on an M2 MBP. The problem: When I start Julia, the REPL prompt shows normally. But when I type my first input, it takes several seconds before it even appears. After the first …

---

## [Multithreaded CSV writes](https://discourse.julialang.org/t/multithreaded-csv-writes/47660)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 20\
**Last updated:** [April 14, 2023, 2:09pm UTC](https://discourse.julialang.org/t/multithreaded-csv-writes/47660 "2023-04-14T14:09:00Z")

</div>

Hi! I am trying to write many data frames to CSV format in parallel. Interestingly, the multi-threaded version is slower than doing it sequentially, and it comes with a very high GC cost. Any idea what’s happening? What …

---

## [Freeze a weight with Flux](https://discourse.julialang.org/t/freeze-a-weight-with-flux/97441)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 1\
**Last updated:** [April 14, 2023, 6:07am UTC](https://discourse.julialang.org/t/freeze-a-weight-with-flux/97441 "2023-04-14T06:07:23Z")

</div>

I have a few linear layers created with Flux. I ran these layers for a few epochs, and would now to freeze all the weights of one of the linear layers, but leaving the bias unfrozen. Could somebody post a MWE demonstrati…

---

## [Leading Zeros got truncated from df column](https://discourse.julialang.org/t/leading-zeros-got-truncated-from-df-column/97409)

<div class="topic-metadata">

**Author:** [@Sandy45](https://discourse.julialang.org/u/Sandy45)\
**Replies:** 7\
**Last updated:** [April 13, 2023, 9:03pm UTC](https://discourse.julialang.org/t/leading-zeros-got-truncated-from-df-column/97409 "2023-04-13T21:03:59Z")

</div>

I have dataframe with integer field and it’s usually consists of time for ex. 0001, 1020, 2359 etc. When there are leading zeros in the column they are being truncated and I’ve tried applying lpad which seems to be does…

---

## [Bitshifting using GMP.MPZ](https://discourse.julialang.org/t/bitshifting-using-gmp-mpz/97356)

<div class="topic-metadata">

**Author:** [@x13420x](https://discourse.julialang.org/u/x13420x)\
**Replies:** 7\
**Last updated:** [April 11, 2023, 10:49pm UTC](https://discourse.julialang.org/t/bitshifting-using-gmp-mpz/97356 "2023-04-11T22:49:53Z")

</div>

I am noticing that the GMP functions are faster that the native julia functions for example: Base.GMP.MPZ.gcd(a,b) 20 percent faster …only tried 2 values…sorry I am certain for 1000 digit numbers I wil…

---

## [What is the most efficiency way to read the 3D matrix?](https://discourse.julialang.org/t/what-is-the-most-efficiency-way-to-read-the-3d-matrix/97184)

<div class="topic-metadata">

**Author:** [@manu\_han](https://discourse.julialang.org/u/manu_han)\
**Replies:** 5\
**Last updated:** [April 12, 2023, 2:01am UTC](https://discourse.julialang.org/t/what-is-the-most-efficiency-way-to-read-the-3d-matrix/97184 "2023-04-12T02:01:40Z")

</div>

Here is 3 D array. TD=rand(150,27,55) I have saved ‘TD’ in a various way as follow. DataFrame(λ\_SPS=collect(eachslice(λ\_SPS,dims=3))) CSV.write(“TD.csv”, TD) DataFrame(λ\_SPS=collect(eachslice(λ\_SPS,dims=1))) CSV.wr…

---

## [Question: Improve the speed of for loop](https://discourse.julialang.org/t/question-improve-the-speed-of-for-loop/97204)

<div class="topic-metadata">

**Author:** [@manu\_han](https://discourse.julialang.org/u/manu_han)\
**Replies:** 20\
**Last updated:** [April 12, 2023, 1:49am UTC](https://discourse.julialang.org/t/question-improve-the-speed-of-for-loop/97204 "2023-04-12T01:49:08Z")

</div>

I have written massive ‘for loop’ code as follows: Meta\_start=390; Meta\_end=400; Meta\_div=trunc(Int,((Meta\_end-Meta\_start)\*100)); #temporary Meta\_cal=LinRange(Meta\_start,Meta\_end,Meta\_div); k=1:1:Meta\_div #::Vec…

---

## [Developing my package with Revise and Pluto is very slow sometimes](https://discourse.julialang.org/t/developing-my-package-with-revise-and-pluto-is-very-slow-sometimes/97306)

<div class="topic-metadata">

**Author:** [@ChunXi\_Zhang](https://discourse.julialang.org/u/ChunXi_Zhang)\
**Replies:** 0\
**Last updated:** [April 10, 2023, 2:26pm UTC](https://discourse.julialang.org/t/developing-my-package-with-revise-and-pluto-is-very-slow-sometimes/97306 "2023-04-10T14:26:18Z")

</div>

I’m doing experienments with my developing package, and runing experienment with it, running training loop in Pluto.jl. So I often need to change some source code and re-run the code to see the effect. This package also …

---

## [Multiple BLISBLAS Threads on Workers](https://discourse.julialang.org/t/multiple-blisblas-threads-on-workers/97269)

<div class="topic-metadata">

**Author:** [@andrew-saydjari](https://discourse.julialang.org/u/andrew-saydjari)\
**Replies:** 3\
**Last updated:** [April 10, 2023, 12:47am UTC](https://discourse.julialang.org/t/multiple-blisblas-threads-on-workers/97269 "2023-04-10T00:47:04Z")

</div>

I am refining a BLAS intensive pipeline and have loved (and gotten a nice speedup from) BLISBLAS.jl. I happen to be running on a cluster with hyperthreading. Currently, I am running using addprocs(SlurmClusterManager()) …

---

## [Applying SnoopPrecompile to ProtoBuf Generated Code](https://discourse.julialang.org/t/applying-snoopprecompile-to-protobuf-generated-code/97240)

<div class="topic-metadata">

**Author:** [@ThomasPluck](https://discourse.julialang.org/u/ThomasPluck)\
**Replies:** 2\
**Last updated:** [April 8, 2023, 11:17am UTC](https://discourse.julialang.org/t/applying-snoopprecompile-to-protobuf-generated-code/97240 "2023-04-08T11:17:09Z")

</div>

Hi, so I’m generating some code using .protofiles, they are the usual messages etc. - I have some building automation that I’m fairly happy with and everything works as intended: These proto files can get quite large,…

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

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