# Performance

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

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

**Page:** 26

---

## [Is it possible to tell which processes are currently free?](https://discourse.julialang.org/t/is-it-possible-to-tell-which-processes-are-currently-free/113305)

<div class="topic-metadata">

**Author:** [@mikel8](https://discourse.julialang.org/u/mikel8)\
**Replies:** 0\
**Last updated:** [April 21, 2024, 3:57pm UTC](https://discourse.julialang.org/t/is-it-possible-to-tell-which-processes-are-currently-free/113305 "2024-04-21T15:57:17Z")

</div>

Hi all, I’m currently writing a distributed program with several workers. At one point in the code, I am trying to have all free workers split up a loop and execute a function for different input data. While I can make …

---

## [Unusual non-deterministic benchmark results](https://discourse.julialang.org/t/unusual-non-deterministic-benchmark-results/113273)

<div class="topic-metadata">

**Author:** [@kdheepak](https://discourse.julialang.org/u/kdheepak)\
**Replies:** 8\
**Last updated:** [April 21, 2024, 3:15am UTC](https://discourse.julialang.org/t/unusual-non-deterministic-benchmark-results/113273 "2024-04-21T03:15:15Z")

</div>

I’m getting some quite unexpected non-deterministic benchmarking results on a toy problem. abstract type Shape end area(::Shape) = 0.0 struct Square \<: Shape side::Float64 end area(s::Square) = s.side \* s.side …

---

## [Best performance for initialising a variable number of matrices/vectors within a Crank-Nicolson scheme](https://discourse.julialang.org/t/best-performance-for-initialising-a-variable-number-of-matrices-vectors-within-a-crank-nicolson-scheme/113083)

<div class="topic-metadata">

**Author:** [@lhcgeneva](https://discourse.julialang.org/u/lhcgeneva)\
**Replies:** 4\
**Last updated:** [April 19, 2024, 6:56am UTC](https://discourse.julialang.org/t/best-performance-for-initialising-a-variable-number-of-matrices-vectors-within-a-crank-nicolson-scheme/113083 "2024-04-19T06:56:05Z")

</div>

I’m solving a diffusion problem of several connected domains. I use a Crank-Nicolson scheme on each domain, and at every time step I connect the domains by some matching conditions at the boundary. To do the Crank-Nicols…

---

## [How do I implement the fastest tensor contractions](https://discourse.julialang.org/t/how-do-i-implement-the-fastest-tensor-contractions/111007)

<div class="topic-metadata">

**Author:** [@Laura](https://discourse.julialang.org/u/Laura)\
**Replies:** 11\
**Last updated:** [April 18, 2024, 1:40pm UTC](https://discourse.julialang.org/t/how-do-i-implement-the-fastest-tensor-contractions/111007 "2024-04-18T13:40:53Z")

</div>

I am writing a program which has a tensor contraction with a 4d symmetrical tensor at it’s core. Needless to say, since it will be used inside a non linear problem solver in the future, I need this tensor contraction to …

---

## [Convert XML Paths to DataFrame Columns](https://discourse.julialang.org/t/convert-xml-paths-to-dataframe-columns/113042)

<div class="topic-metadata">

**Author:** [@jjAtNxtPt](https://discourse.julialang.org/u/jjAtNxtPt)\
**Replies:** 0\
**Last updated:** [April 17, 2024, 12:00am UTC](https://discourse.julialang.org/t/convert-xml-paths-to-dataframe-columns/113042 "2024-04-17T00:00:57Z")

</div>

I pull data from a database into a data frame with just two columns, ID and XMLData. I need to parse out a list of 125 (for now) up to 240+ xpaths into new columns of the dataframe. I broadcast the parse function over …

---

## [Efficiently loading a batch of .mat files](https://discourse.julialang.org/t/efficiently-loading-a-batch-of-mat-files/113036)

<div class="topic-metadata">

**Author:** [@vict\_riag](https://discourse.julialang.org/u/vict_riag)\
**Replies:** 2\
**Last updated:** [April 16, 2024, 8:46pm UTC](https://discourse.julialang.org/t/efficiently-loading-a-batch-of-mat-files/113036 "2024-04-16T20:46:13Z")

</div>

Hello, I am new at optimizing julia code. Currently I am working on a project translating a model in MATLAB to Julia. There is a large amount of starting data for this model written in .mat files. Right now, I am develo…

---

## [Large amount of RAM for double for loop for dictionaries](https://discourse.julialang.org/t/large-amount-of-ram-for-double-for-loop-for-dictionaries/113029)

<div class="topic-metadata">

**Author:** [@christmas\_jones](https://discourse.julialang.org/u/christmas_jones)\
**Replies:** 10\
**Last updated:** [April 16, 2024, 7:20pm UTC](https://discourse.julialang.org/t/large-amount-of-ram-for-double-for-loop-for-dictionaries/113029 "2024-04-16T19:20:38Z")

</div>

I have a function that computes a float value from two dictionaries (basically by ‘multiplying’ the dictionaries, with a constraint that the keys (tuples) summed pairwise are in another set), but it uses a huge amount of…

---

## [Help me understand multi-threaded scaling for matrix multiplication](https://discourse.julialang.org/t/help-me-understand-multi-threaded-scaling-for-matrix-multiplication/112926)

<div class="topic-metadata">

**Author:** [@RayleighLord](https://discourse.julialang.org/u/RayleighLord)\
**Replies:** 22\
**Last updated:** [April 16, 2024, 6:29pm UTC](https://discourse.julialang.org/t/help-me-understand-multi-threaded-scaling-for-matrix-multiplication/112926 "2024-04-16T18:29:13Z")

</div>

Hello, I would like to begin by clarifying that I have very little knowledge of multithreading. I was experimenting with the following code, using the MKL library to perform matrix multiplications with a different numbe…

---

## [Are there any tools in julia that can test the peak memory consumption of the functions I wrote?](https://discourse.julialang.org/t/are-there-any-tools-in-julia-that-can-test-the-peak-memory-consumption-of-the-functions-i-wrote/113011)

<div class="topic-metadata">

**Author:** [@F-YF](https://discourse.julialang.org/u/F-YF)\
**Replies:** 1\
**Last updated:** [April 16, 2024, 1:00pm UTC](https://discourse.julialang.org/t/are-there-any-tools-in-julia-that-can-test-the-peak-memory-consumption-of-the-functions-i-wrote/113011 "2024-04-16T13:00:03Z")

</div>

Let’s look at this example first: julia\> using BenchmarkTools julia\> julia\> function f(x::Matrix{Float64}) y = x \* x return nothing end f (generic function with 1 method) julia\> julia\> …

---

## [Optimising iterative solution of small system](https://discourse.julialang.org/t/optimising-iterative-solution-of-small-system/112885)

<div class="topic-metadata">

**Author:** [@alemelis](https://discourse.julialang.org/u/alemelis)\
**Replies:** 12\
**Last updated:** [April 16, 2024, 7:46am UTC](https://discourse.julialang.org/t/optimising-iterative-solution-of-small-system/112885 "2024-04-16T07:46:29Z")

</div>

Hello again, I’m solving iteratively this system of 6 equations as part of a larger simulation Toy datausing StaticArrays using LinearAlgebra mutable struct V{T} u::T A::T A0::T γ::T β::T end st…

---

## [Will return allocate memory?](https://discourse.julialang.org/t/will-return-allocate-memory/112987)

<div class="topic-metadata">

**Author:** [@Strange\_Xue](https://discourse.julialang.org/u/Strange_Xue)\
**Replies:** 3\
**Last updated:** [April 16, 2024, 1:19am UTC](https://discourse.julialang.org/t/will-return-allocate-memory/112987 "2024-04-16T01:19:00Z")

</div>

Hi guys, looking at the following two versions of codes. I found more allocations in version 2 perhaps because b is returned in version 2. However, b = \[a\] is also operated in both versions. Why is there a big difference…

---

## [Is Julia slow at closing files on Windows?](https://discourse.julialang.org/t/is-julia-slow-at-closing-files-on-windows/112983)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 1\
**Last updated:** [April 16, 2024, 12:38am UTC](https://discourse.julialang.org/t/is-julia-slow-at-closing-files-on-windows/112983 "2024-04-16T00:38:21Z")

</div>

Hello! It is hard to provide a MWE, since this is a pattern I observe when running a simulation in Julia. I time the different operation and I see that closing a file through HDF5.jl takes up more time than I think it s…

---

## [How to reduce a (reshaped) sparse matrix to a max or sum with acceptable speed?](https://discourse.julialang.org/t/how-to-reduce-a-reshaped-sparse-matrix-to-a-max-or-sum-with-acceptable-speed/112888)

<div class="topic-metadata">

**Author:** [@oscarvdvelde](https://discourse.julialang.org/u/oscarvdvelde)\
**Replies:** 14\
**Last updated:** [April 15, 2024, 1:21am UTC](https://discourse.julialang.org/t/how-to-reduce-a-reshaped-sparse-matrix-to-a-max-or-sum-with-acceptable-speed/112888 "2024-04-15T01:21:40Z")

</div>

I generated a 3240000×1460 SparseMatrixCSC{UInt8, Int64} with 518339 stored entries, hereafter called activitygrid. It holds a spatial 3D grid (dims: 300,300,36) every 30 seconds of a 12 hour period. It was very fast to …

---

## [Combining multi-processing and multi-threading](https://discourse.julialang.org/t/combining-multi-processing-and-multi-threading/112695)

<div class="topic-metadata">

**Author:** [@sschlenkrich](https://discourse.julialang.org/u/sschlenkrich)\
**Replies:** 8\
**Last updated:** [April 14, 2024, 8:57am UTC](https://discourse.julialang.org/t/combining-multi-processing-and-multi-threading/112695 "2024-04-14T08:57:02Z")

</div>

I have a complex numerical simulation which I want to parallelise on large machines. I struggle a bit with the optimal parallelisation strategy. And I am hoping to get some hints what to try/avoid from the community. To…

---

## [Is there a faster way to perform this reduction?](https://discourse.julialang.org/t/is-there-a-faster-way-to-perform-this-reduction/112915)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 4\
**Last updated:** [April 13, 2024, 11:39pm UTC](https://discourse.julialang.org/t/is-there-a-faster-way-to-perform-this-reduction/112915 "2024-04-13T23:39:36Z")

</div>

Hello! I’ve wondered if there is faster/straight-forward way to improve the speed of this way of performing reduction? using BenchmarkTools using Random # Define the function reduce\_sum! function reduce\_sum!(target\_ar…

---

## [Task scheduling puzzle](https://discourse.julialang.org/t/task-scheduling-puzzle/112876)

<div class="topic-metadata">

**Author:** [@sgaure](https://discourse.julialang.org/u/sgaure)\
**Replies:** 0\
**Last updated:** [April 12, 2024, 12:58pm UTC](https://discourse.julialang.org/t/task-scheduling-puzzle/112876 "2024-04-12T12:58:41Z")

</div>

I have a somewhat puzzling behaviour with task scheduling. I’ve this example: using BenchmarkTools using Base.Threads function work(n) x = pi/4 for i in 1:n x \*= 4\*(1-x) (i & 0x3ff == 0) && yiel…

---

## [Elegant way to vcat vectors and remove nothing elements?](https://discourse.julialang.org/t/elegant-way-to-vcat-vectors-and-remove-nothing-elements/112835)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 5\
**Last updated:** [April 11, 2024, 10:10pm UTC](https://discourse.julialang.org/t/elegant-way-to-vcat-vectors-and-remove-nothing-elements/112835 "2024-04-11T22:10:16Z")

</div>

Suppose I have: a = \[1;2;3\] b = \[4;5;6\] c = nothing d = \[7;8;9\] In my code, somtimes c will have values, other times it will not. I can guarantee that the type of all variables is the same. What I want is then a functi…

---

## [Package keeps precompiling after starting Julia every single time](https://discourse.julialang.org/t/package-keeps-precompiling-after-starting-julia-every-single-time/112843)

<div class="topic-metadata">

**Author:** [@claud10c](https://discourse.julialang.org/u/claud10c)\
**Replies:** 2\
**Last updated:** [April 11, 2024, 9:14pm UTC](https://discourse.julialang.org/t/package-keeps-precompiling-after-starting-julia-every-single-time/112843 "2024-04-11T21:14:22Z")

</div>

I have created a package for computing maximum independent sets. The package uses two JLL wrappers built by me as well. The package is registered and you can load it using \] add MaximumIndependentSet. The source code is…

---

## [Running Julia in a SLURM Cluster](https://discourse.julialang.org/t/running-julia-in-a-slurm-cluster/67614)

<div class="topic-metadata">

**Author:** [@Noah\_Guzman](https://discourse.julialang.org/u/Noah_Guzman)\
**Replies:** 6\
**Last updated:** [April 11, 2024, 11:11am UTC](https://discourse.julialang.org/t/running-julia-in-a-slurm-cluster/67614 "2024-04-11T11:11:15Z")

</div>

I’m looking to provide an explicit explanation of the simplest way to get a Julia program running in parallel across multiple nodes in a SLURM cluster (basically a minimal working example that illustrates the logic). My…

---

## [Passing all variables of an outer function to an inner function?](https://discourse.julialang.org/t/passing-all-variables-of-an-outer-function-to-an-inner-function/112726)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 9\
**Last updated:** [April 9, 2024, 3:06pm UTC](https://discourse.julialang.org/t/passing-all-variables-of-an-outer-function-to-an-inner-function/112726 "2024-04-09T15:06:11Z")

</div>

Suppose I have a function structure: function NeighborLoop!(f::Function, a,b,c,d) f(a,b,c,d) end In this case I have to double specify all the variables. Is there a smart and easy way to pass all variables from Neigh…

---

## [Programming Language Benchmark 2](https://discourse.julialang.org/t/programming-language-benchmark-2/108429)

<div class="topic-metadata">

**Author:** [@jakobnissen](https://discourse.julialang.org/u/jakobnissen)\
**Replies:** 25\
**Last updated:** [April 8, 2024, 5:30pm UTC](https://discourse.julialang.org/t/programming-language-benchmark-2/108429 "2024-04-08T17:30:11Z")

</div>

The programmer attractivechaos has created a new benchmark comparing different programming languages, hosted at GitHub - attractivechaos/plb2: A programming language benchmark. It’s a quite nice benchmark, being small en…

---

## [Sorting a StructArray variable faster and how to update values?](https://discourse.julialang.org/t/sorting-a-structarray-variable-faster-and-how-to-update-values/112621)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 6\
**Last updated:** [April 7, 2024, 1:06pm UTC](https://discourse.julialang.org/t/sorting-a-structarray-variable-faster-and-how-to-update-values/112621 "2024-04-07T13:06:16Z")

</div>

Hello! I have a runnable MWE here, put into a small module to easily redefine struct as needed: module ParticleSorting export sort\_particles\_by\_density using StructArrays using StaticArrays using BenchmarkTools using…

---

## [Cubic spline for non monotonic vector](https://discourse.julialang.org/t/cubic-spline-for-non-monotonic-vector/112599)

<div class="topic-metadata">

**Author:** [@jgr](https://discourse.julialang.org/u/jgr)\
**Replies:** 5\
**Last updated:** [April 6, 2024, 7:48pm UTC](https://discourse.julialang.org/t/cubic-spline-for-non-monotonic-vector/112599 "2024-04-06T19:48:59Z")

</div>

I am using Spline1D from Dierckx package, and my code is Ev = \[2, 1, 3,4\] sgrid = \[0, 1, 2,4\] spl = Spline1D(Ev,sgrid) The error I got is Error on entry, no approximation returned. The following conditions must hold: …

---

## [Julia slower than Python for finding pangrams?](https://discourse.julialang.org/t/julia-slower-than-python-for-finding-pangrams/112481)

<div class="topic-metadata">

**Author:** [@Flavio\_Barros](https://discourse.julialang.org/u/Flavio_Barros)\
**Replies:** 28\
**Last updated:** [April 5, 2024, 11:55pm UTC](https://discourse.julialang.org/t/julia-slower-than-python-for-finding-pangrams/112481 "2024-04-05T23:55:34Z")

</div>

I came up with a neat Julia solution using sets to solve that simple pangram. However, I’m a bit perplexed… C benchmarks show it running over 200 times faster, and even Python outperforms my Julia code substantially. Cur…

---

## [Optimising superbee! function](https://discourse.julialang.org/t/optimising-superbee-function/112568)

<div class="topic-metadata">

**Author:** [@alemelis](https://discourse.julialang.org/u/alemelis)\
**Replies:** 20\
**Last updated:** [April 5, 2024, 4:40pm UTC](https://discourse.julialang.org/t/optimising-superbee-function/112568 "2024-04-05T16:40:55Z")

</div>

Hello, I’m profiling my simulation with profview and this is the flame graph where I’m pointing to the four function calls that seem to be among the most expensive. Those are calling the same function – superbee! – i…

---

## [Code compiled with PackageCompiler allocates more](https://discourse.julialang.org/t/code-compiled-with-packagecompiler-allocates-more/112470)

<div class="topic-metadata">

**Author:** [@Kruxigt](https://discourse.julialang.org/u/Kruxigt)\
**Replies:** 0\
**Last updated:** [April 3, 2024, 12:55pm UTC](https://discourse.julialang.org/t/code-compiled-with-packagecompiler-allocates-more/112470 "2024-04-03T12:55:46Z")

</div>

If I compile some code with PackageCompiler and then run julia\> v = \[1,2,3,4\]; julia\> q = view(v,1:2); julia\> @time collect(q); 0.000108 seconds (33 allocations: 1008 bytes) while if I do the same in the standard Jul…

---

## [StaticTools](https://discourse.julialang.org/t/statictools/112456)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Replies:** 2\
**Last updated:** [April 3, 2024, 12:09pm UTC](https://discourse.julialang.org/t/statictools/112456 "2024-04-03T12:09:06Z")

</div>

Hi, First: I am very much looking forward to StaticCompiler.jl on Windows, I will be putting it to good use! I understand it’s early days, but I wanted to try out StaticTools.jl to get a feel for the “static dialect”. …

---

## [Multi-threading packages - preferences, use cases. recommendations?](https://discourse.julialang.org/t/multi-threading-packages-preferences-use-cases-recommendations/112436)

<div class="topic-metadata">

**Author:** [@braamvandyk](https://discourse.julialang.org/u/braamvandyk)\
**Replies:** 2\
**Last updated:** [April 2, 2024, 7:19pm UTC](https://discourse.julialang.org/t/multi-threading-packages-preferences-use-cases-recommendations/112436 "2024-04-02T19:19:48Z")

</div>

I have so far not specifically needed to multi-thread any of my code. I have, out of curiosity, tossed the odd @threads in front of one or two for loops to see if it made enough of a difference to bother, but the calcula…

---

## [Saving and updating in-memory HDF5 files?](https://discourse.julialang.org/t/saving-and-updating-in-memory-hdf5-files/112395)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 3\
**Last updated:** [April 2, 2024, 4:52pm UTC](https://discourse.julialang.org/t/saving-and-updating-in-memory-hdf5-files/112395 "2024-04-02T16:52:46Z")

</div>

Hello! Reading the documentation of HDF5.jl (Home · HDF5.jl) I see how it is possible to have an in-memory hdf5 file. I was wondering if; Can I update a dataset in an hdf in place? Can I save a copy of the current in-…

---

## [Lazy vcat of matrices just before multiplication](https://discourse.julialang.org/t/lazy-vcat-of-matrices-just-before-multiplication/112387)

<div class="topic-metadata">

**Author:** [@Tomas\_Pevny](https://discourse.julialang.org/u/Tomas_Pevny)\
**Replies:** 3\
**Last updated:** [April 2, 2024, 5:16am UTC](https://discourse.julialang.org/t/lazy-vcat-of-matrices-just-before-multiplication/112387 "2024-04-02T05:16:11Z")

</div>

Dear All, I am implementing neural network for hyper-multigraph (this is not a joke, the graph has multiple types of edges of arities higher than 3). This is “fairly” straightforward extension of the Mill.jl framework. …

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

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