# Performance

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

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

**Page:** 13

---

## [Multi-thread speed in very large vectors](https://discourse.julialang.org/t/multi-thread-speed-in-very-large-vectors/125342)

<div class="topic-metadata">

**Author:** [@pjssilva](https://discourse.julialang.org/u/pjssilva)\
**Replies:** 11\
**Last updated:** [February 3, 2025, 3:02pm UTC](https://discourse.julialang.org/t/multi-thread-speed-in-very-large-vectors/125342 "2025-02-03T15:02:26Z")

</div>

Hi, I am trying to get my toes wet on some multi-threading code using the great OhMyThreads package. But there is a behavior that I don’t understand. I can exemplify it using the sum function. The most natural implementa…

---

## [Most recent binary artifact (GMT\_jll) is not being updated, nor installed on fresh installs of GMT.jl](https://discourse.julialang.org/t/most-recent-binary-artifact-gmt-jll-is-not-being-updated-nor-installed-on-fresh-installs-of-gmt-jl/125473)

<div class="topic-metadata">

**Author:** [@joa-quim](https://discourse.julialang.org/u/joa-quim)\
**Replies:** 6\
**Last updated:** [February 2, 2025, 9:34pm UTC](https://discourse.julialang.org/t/most-recent-binary-artifact-gmt-jll-is-not-being-updated-nor-installed-on-fresh-installs-of-gmt-jl/125473 "2025-02-02T21:34:43Z")

</div>

Hi, Don’t know what is happening but the new builds of the GMT\_jll artifact are not being installed. The artifact, 6.5.3+1, was created fine (GitHub - JuliaBinaryWrappers/GMT\_jll.jl at GMT-v6.5.3+1) but what keeps being…

---

## [What is the best way to get a running matrix-product over a large 3D array](https://discourse.julialang.org/t/what-is-the-best-way-to-get-a-running-matrix-product-over-a-large-3d-array/125452)

<div class="topic-metadata">

**Author:** [@SanAlphaTau](https://discourse.julialang.org/u/SanAlphaTau)\
**Replies:** 9\
**Last updated:** [February 2, 2025, 4:44pm UTC](https://discourse.julialang.org/t/what-is-the-best-way-to-get-a-running-matrix-product-over-a-large-3d-array/125452 "2025-02-02T16:44:16Z")

</div>

Heya, I am doing some markov process simulations which output NxN matrices these are stored (currently) in a 3D array X\[N, N, M) where M can be very large (1E6 or more). My code currently uses a reduce statement reduce…

---

## [Unclear allocation behaviour with built-in sum()](https://discourse.julialang.org/t/unclear-allocation-behaviour-with-built-in-sum/125304)

<div class="topic-metadata">

**Author:** [@Deceneu](https://discourse.julialang.org/u/Deceneu)\
**Replies:** 4\
**Last updated:** [February 2, 2025, 1:04am UTC](https://discourse.julialang.org/t/unclear-allocation-behaviour-with-built-in-sum/125304 "2025-02-02T01:04:34Z")

</div>

Hello, Introduction I’ve been trying to process some data and I’ve encountered crippling allocation when using the built-in sum(). I have some mid-level understanding of how to increase performance in Julia, but regardi…

---

## [Literate.jl, Documenter.jl, GLMakie.jl and GitHub](https://discourse.julialang.org/t/literate-jl-documenter-jl-glmakie-jl-and-github/125386)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Replies:** 15\
**Last updated:** [January 31, 2025, 12:51pm UTC](https://discourse.julialang.org/t/literate-jl-documenter-jl-glmakie-jl-and-github/125386 "2025-01-31T12:51:39Z")

</div>

Hi To create the doc of Muscade.jl, I use Literate.jl to run an example, which generates graphics (GLMakie.jl) and \*.md files, that Documenter.jl compiles into \*.html. This all works fine on my computer, but the docume…

---

## [Parallel computing doesn't work in my case?](https://discourse.julialang.org/t/parallel-computing-doesnt-work-in-my-case/125395)

<div class="topic-metadata">

**Author:** [@D\_W](https://discourse.julialang.org/u/D_W)\
**Replies:** 4\
**Last updated:** [January 30, 2025, 6:32pm UTC](https://discourse.julialang.org/t/parallel-computing-doesnt-work-in-my-case/125395 "2025-01-30T18:32:44Z")

</div>

I tried both multi-threading and distributed computing. However, it seems that neither improves the performance; the best way is just to use regular for loop. using BenchmarkTools using Distributed addprocs(2 - nprocs()…

---

## [Packing and unpacking an array of N-bit ints](https://discourse.julialang.org/t/packing-and-unpacking-an-array-of-n-bit-ints/125280)

<div class="topic-metadata">

**Author:** [@lntricate](https://discourse.julialang.org/u/lntricate)\
**Replies:** 5\
**Last updated:** [January 27, 2025, 10:42pm UTC](https://discourse.julialang.org/t/packing-and-unpacking-an-array-of-n-bit-ints/125280 "2025-01-27T22:42:52Z")

</div>

Given an IO, I want to read N bits into each index of an Array{UInt64} and vice-versa: For example, the data \[0b0\_101\_100\_011\_010\_001\_000\_111\_110\_101\_100\_011\_010\_001\_000\_111\_110\_101\_100\_011\_010\_001, 0b00\_010\_001\_000\_111\_…

---

## [Understanding \`Base.findall\` and customizing it](https://discourse.julialang.org/t/understanding-base-findall-and-customizing-it/125220)

<div class="topic-metadata">

**Author:** [@Leo\_I](https://discourse.julialang.org/u/Leo_I)\
**Replies:** 2\
**Last updated:** [January 26, 2025, 1:24pm UTC](https://discourse.julialang.org/t/understanding-base-findall-and-customizing-it/125220 "2025-01-26T13:24:58Z")

</div>

Given a vector ww, I wish to obtain all its nonzero values and the corresponding positions (with specified type). I solve this with: using BenchmarkTools, Test function \_find0(::tp, ww::AbstractVector{tw}) ::Tuple{Vecto…

---

## [Dict with integer keys and fastest insertion?](https://discourse.julialang.org/t/dict-with-integer-keys-and-fastest-insertion/125171)

<div class="topic-metadata">

**Author:** [@Leo\_I](https://discourse.julialang.org/u/Leo_I)\
**Replies:** 8\
**Last updated:** [January 25, 2025, 1:28pm UTC](https://discourse.julialang.org/t/dict-with-integer-keys-and-fastest-insertion/125171 "2025-01-25T13:28:35Z")

</div>

What are the best options for a dict/map with integer keys and the fastest insert/update? For background, I wish to aggregate those position-weight pairs (p,w) where the position is the same, I’m tinkering with the idea …

---

## [Sum over tuple slower than sum over array](https://discourse.julialang.org/t/sum-over-tuple-slower-than-sum-over-array/125162)

<div class="topic-metadata">

**Author:** [@miguelborrero](https://discourse.julialang.org/u/miguelborrero)\
**Replies:** 3\
**Last updated:** [January 24, 2025, 12:34pm UTC](https://discourse.julialang.org/t/sum-over-tuple-slower-than-sum-over-array/125162 "2025-01-24T12:34:18Z")

</div>

Hi there, I wrote a trivial sum function: function my\_sum(collection) s = zero(eltype(collection)) for i in eachindex(collection) s += collection\[i\] end return s end When I apply it to a tuple …

---

## [Intriguing performance comparison results.... threads, comprehensions, etc](https://discourse.julialang.org/t/intriguing-performance-comparison-results-threads-comprehensions-etc/125093)

<div class="topic-metadata">

**Author:** [@Joris\_Pinkse](https://discourse.julialang.org/u/Joris_Pinkse)\
**Replies:** 11\
**Last updated:** [January 23, 2025, 7:03pm UTC](https://discourse.julialang.org/t/intriguing-performance-comparison-results-threads-comprehensions-etc/125093 "2025-01-23T19:03:56Z")

</div>

Can anyone provide me with intuition for the poor performance of the dynamic threads for loop in the example below? (all second run times) Thanks! using LinearAlgebra, .Threads function test( Y, ::Val{1} ) X = …

---

## [Calculating "triple" dot products](https://discourse.julialang.org/t/calculating-triple-dot-products/124840)

<div class="topic-metadata">

**Author:** [@kevinli1993](https://discourse.julialang.org/u/kevinli1993)\
**Replies:** 14\
**Last updated:** [January 22, 2025, 3:29pm UTC](https://discourse.julialang.org/t/calculating-triple-dot-products/124840 "2025-01-22T15:29:49Z")

</div>

I have Float64 arrays x, y, z and want to compute sum(x\[i\] \* y\[i\] \* z\[i\]) over all indices i. I’m curious what is the fastest way to calculate this? Some ideas: a plain for loop Einsum.jl OMEinsum.jl LinearAlgebra.do…

---

## [Benchmarking function compile time](https://discourse.julialang.org/t/benchmarking-function-compile-time/125013)

<div class="topic-metadata">

**Author:** [@AntonReinhard](https://discourse.julialang.org/u/AntonReinhard)\
**Replies:** 10\
**Last updated:** [January 22, 2025, 10:33am UTC](https://discourse.julialang.org/t/benchmarking-function-compile-time/125013 "2025-01-22T10:33:11Z")

</div>

I have some code that generates functions at runtime that vary greatly in size (10 to 100k lines of code). I’d like to benchmark the compilation of these functions. Is there any intended way to do this? Something like a …

---

## [Abysmal performance when reading block of data from disk with Julia](https://discourse.julialang.org/t/abysmal-performance-when-reading-block-of-data-from-disk-with-julia/124988)

<div class="topic-metadata">

**Author:** [@world-peace](https://discourse.julialang.org/u/world-peace)\
**Replies:** 15\
**Last updated:** [January 21, 2025, 4:13pm UTC](https://discourse.julialang.org/t/abysmal-performance-when-reading-block-of-data-from-disk-with-julia/124988 "2025-01-21T16:13:49Z")

</div>

See the code below. const count = 10000 function create() v = rand(Int64, count) open("data.bin", "w") do ofile write(ofile, v) end end function test() open("data.bin") do ifile v = Vec…

---

## [Create\_library method not exporting the ccallable function](https://discourse.julialang.org/t/create-library-method-not-exporting-the-ccallable-function/124950)

<div class="topic-metadata">

**Author:** [@Sandy45](https://discourse.julialang.org/u/Sandy45)\
**Replies:** 0\
**Last updated:** [January 20, 2025, 6:29am UTC](https://discourse.julialang.org/t/create-library-method-not-exporting-the-ccallable-function/124950 "2025-01-20T06:29:36Z")

</div>

I am trying to precompile my module using create\_library method and try to call the functions exported in dll files from my julia app but create\_library isn’t exporting ccallable functions that has been created in my mod…

---

## [Simple, understandable iterator](https://discourse.julialang.org/t/simple-understandable-iterator/124937)

<div class="topic-metadata">

**Author:** [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Replies:** 0\
**Last updated:** [January 20, 2025, 1:24am UTC](https://discourse.julialang.org/t/simple-understandable-iterator/124937 "2025-01-20T01:24:44Z")

</div>

It’s been noted that a lot of Julia code has more unnecessary allocation and construction of containers than, say, Rust code. I think this is due in large part to Julia’s dual role as a programming language and an applic…

---

## [@threads in for loop and push! in if statement](https://discourse.julialang.org/t/threads-in-for-loop-and-push-in-if-statement/124916)

<div class="topic-metadata">

**Author:** [@Stephen](https://discourse.julialang.org/u/Stephen)\
**Replies:** 6\
**Last updated:** [January 20, 2025, 1:19am UTC](https://discourse.julialang.org/t/threads-in-for-loop-and-push-in-if-statement/124916 "2025-01-20T01:19:21Z")

</div>

Hello there, I’m using @threads to accelerate my for loop, I don’t know how to push! a variable in if , I ask ChatGPT, it gives the code as following: # Initialize an empty array to store symbols, shared across threads …

---

## [Poor parallel speedup](https://discourse.julialang.org/t/poor-parallel-speedup/124782)

<div class="topic-metadata">

**Author:** [@billmclean](https://discourse.julialang.org/u/billmclean)\
**Replies:** 2\
**Last updated:** [January 17, 2025, 3:14am UTC](https://discourse.julialang.org/t/poor-parallel-speedup/124782 "2025-01-17T03:14:49Z")

</div>

I want to understand why some code exhibits fairly poor parallel speedup. In simplified form, I am just computing a discrete Laplacian over a 3D grid: function discrete\_laplacian!(AU::Array{T,3}, U::OffsetArray{T,3}) w…

---

## [Create executable file to be used in another julia project](https://discourse.julialang.org/t/create-executable-file-to-be-used-in-another-julia-project/124777)

<div class="topic-metadata">

**Author:** [@Sandy45](https://discourse.julialang.org/u/Sandy45)\
**Replies:** 8\
**Last updated:** [January 16, 2025, 9:37pm UTC](https://discourse.julialang.org/t/create-executable-file-to-be-used-in-another-julia-project/124777 "2025-01-16T21:37:47Z")

</div>

I am trying to create executable file(probably .so file) that can be used in my another julia project to access methods in it. I have tried to do it so using package compiler but getting below errors while using methods …

---

## [Parallel Assembly of Matrices in FEM](https://discourse.julialang.org/t/parallel-assembly-of-matrices-in-fem/124561)

<div class="topic-metadata">

**Author:** [@priyanshuFSI](https://discourse.julialang.org/u/priyanshuFSI)\
**Replies:** 8\
**Last updated:** [January 16, 2025, 4:46am UTC](https://discourse.julialang.org/t/parallel-assembly-of-matrices-in-fem/124561 "2025-01-16T04:46:58Z")

</div>

Hi. I am writing a CFD solver using Finite Element Methods. I encounter issues in assembling the sparse matrices( specially in regards with the performance). I construct a sparse matrix in CSC form. This function works f…

---

## [How slow is runtime dispatch, anyway? Benchmark attempts](https://discourse.julialang.org/t/how-slow-is-runtime-dispatch-anyway-benchmark-attempts/124751)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 8\
**Last updated:** [January 15, 2025, 1:19am UTC](https://discourse.julialang.org/t/how-slow-is-runtime-dispatch-anyway-benchmark-attempts/124751 "2025-01-15T01:19:09Z")

</div>

It’s not actually easy to separate the timing of the runtime dispatches from the surrounding code, and I wasn’t much convinced by the few benchmarks people have tried, even if just counting the ones did control the numbe…

---

## [Help with reducing allocations when indexing into custom Array](https://discourse.julialang.org/t/help-with-reducing-allocations-when-indexing-into-custom-array/124732)

<div class="topic-metadata">

**Author:** [@thomasc791](https://discourse.julialang.org/u/thomasc791)\
**Replies:** 10\
**Last updated:** [January 14, 2025, 10:21pm UTC](https://discourse.julialang.org/t/help-with-reducing-allocations-when-indexing-into-custom-array/124732 "2025-01-14T22:21:09Z")

</div>

Hi everyone, I am quite new to the language, and was wondering if people could help me optimising my piece of code. The idea for this array type is to reduce the total Base.summarysize for a vector of vector as much as …

---

## [Optimizing a simple random walk simulation](https://discourse.julialang.org/t/optimizing-a-simple-random-walk-simulation/124653)

<div class="topic-metadata">

**Author:** [@aris](https://discourse.julialang.org/u/aris)\
**Replies:** 41\
**Last updated:** [January 13, 2025, 10:49am UTC](https://discourse.julialang.org/t/optimizing-a-simple-random-walk-simulation/124653 "2025-01-13T10:49:45Z")

</div>

Hello everyone, Suppose we have a simple random walk simulation, where a collection of walkers take a step towards a random direction at each time step. For each walker at each step, if some condition is met, the walker…

---

## [Understanding compilation with Optim.jl and OrdinaryDiffEq.jl](https://discourse.julialang.org/t/understanding-compilation-with-optim-jl-and-ordinarydiffeq-jl/124566)

<div class="topic-metadata">

**Author:** [@ysfoo](https://discourse.julialang.org/u/ysfoo)\
**Replies:** 7\
**Last updated:** [January 13, 2025, 8:05am UTC](https://discourse.julialang.org/t/understanding-compilation-with-optim-jl-and-ordinarydiffeq-jl/124566 "2025-01-13T08:05:54Z")

</div>

I’m currently working on numerical optimisation problems that involve solving ODEs, similar to this. I’m trying to understand recurring TTFX when I repeatedly run variations of numerical optimisation problems. Here’s th…

---

## [Policy function algorithm becomes much slower when I increase the upper bound of the grid](https://discourse.julialang.org/t/policy-function-algorithm-becomes-much-slower-when-i-increase-the-upper-bound-of-the-grid/124536)

<div class="topic-metadata">

**Author:** [@SGHoekstra](https://discourse.julialang.org/u/SGHoekstra)\
**Replies:** 4\
**Last updated:** [January 10, 2025, 5:03pm UTC](https://discourse.julialang.org/t/policy-function-algorithm-becomes-much-slower-when-i-increase-the-upper-bound-of-the-grid/124536 "2025-01-10T17:03:58Z")

</div>

Dear all, I am facing a performance issue that I find hard to understand so I am hoping I can gain some insights here. I have written code to solve an economic problem using fixed point iteration or also known as policy…

---

## [Memory Allocation in \`@time\` but not in \`AllocCheck.check\_allocs\`](https://discourse.julialang.org/t/memory-allocation-in-time-but-not-in-alloccheck-check-allocs/124638)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 2\
**Last updated:** [January 10, 2025, 3:28pm UTC](https://discourse.julialang.org/t/memory-allocation-in-time-but-not-in-alloccheck-check-allocs/124638 "2025-01-10T15:28:43Z")

</div>

Hi there, I am wondering what this is about: In @time I see an allocation of 16 Bytes. When using AllocCheck.check\_allocs, everything is clean. Here a code example: using Statistics using LinearAlgebra using StaticAr…

---

## [Struct containing a dictionary of cache buffers?](https://discourse.julialang.org/t/struct-containing-a-dictionary-of-cache-buffers/124643)

<div class="topic-metadata">

**Author:** [@cocoa1231](https://discourse.julialang.org/u/cocoa1231)\
**Replies:** 1\
**Last updated:** [January 10, 2025, 2:52pm UTC](https://discourse.julialang.org/t/struct-containing-a-dictionary-of-cache-buffers/124643 "2025-01-10T14:52:45Z")

</div>

I want to have a few buffers and/or dicts that serve as caches for various methods I’m implementing on my struct. This struct will basically be alive for the lifetime of the program as it’s a wrapper containing informati…

---

## [StaticArrays solve symmetric linear system - seems typeinstable](https://discourse.julialang.org/t/staticarrays-solve-symmetric-linear-system-seems-typeinstable/124634)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 2\
**Last updated:** [January 10, 2025, 2:25pm UTC](https://discourse.julialang.org/t/staticarrays-solve-symmetric-linear-system-seems-typeinstable/124634 "2025-01-10T14:25:03Z")

</div>

Hi there, I am wondering why the following does not return a SVector, but allocates a normal Vector. Also warntype shows problems using StaticArrays using LinearAlgebra using Statistics function testme(xs=rand(20)) …

---

## [Poor performance of SIMD vectorization in the latest version of Julia (v1.11.2)](https://discourse.julialang.org/t/poor-performance-of-simd-vectorization-in-the-latest-version-of-julia-v1-11-2/124406)

<div class="topic-metadata">

**Author:** [@Mikel\_Antonana](https://discourse.julialang.org/u/Mikel_Antonana)\
**Replies:** 19\
**Last updated:** [January 8, 2025, 11:17am UTC](https://discourse.julialang.org/t/poor-performance-of-simd-vectorization-in-the-latest-version-of-julia-v1-11-2/124406 "2025-01-08T11:17:27Z")

</div>

I have observed poor performance of our SIMD-vectorized numerical integration method when using the latest version of Julia (1.11.2). To show this, I am attaching two precision diagrams obtained by running this Jupyter …

---

## [\[pre-ANN\] StackEnvs.jl](https://discourse.julialang.org/t/pre-ann-stackenvs-jl/124487)

<div class="topic-metadata">

**Author:** [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Replies:** 0\
**Last updated:** [January 7, 2025, 12:19am UTC](https://discourse.julialang.org/t/pre-ann-stackenvs-jl/124487 "2025-01-07T00:19:40Z")

</div>

StackEnvs.jl From the README: StackEnvs provides tools for minimal management of a shared environment that is meant to be used from your “stacked environment” but never to be active itself. This is useful if you are d…

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

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