# Performance

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

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

**Page:** 75

---

## [\[Review wanted\] Adam gradient descent with complicated gradient to fit multivariate gamma convolutions](https://discourse.julialang.org/t/review-wanted-adam-gradient-descent-with-complicated-gradient-to-fit-multivariate-gamma-convolutions/74183)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 2\
**Last updated:** [January 7, 2022, 2:33pm UTC](https://discourse.julialang.org/t/review-wanted-adam-gradient-descent-with-complicated-gradient-to-fit-multivariate-gamma-convolutions/74183 "2022-01-07T14:33:11Z")

</div>

Hi, I have written a code that fits a multivariate gamma convolution to a dataset using a stochastic gradient descent on a home-made loss. Most of the code is directed into the computation of the gradient, which is of c…

---

## [Improving performance on nested for loops (SparseArrays, LibGEOS)](https://discourse.julialang.org/t/improving-performance-on-nested-for-loops-sparsearrays-libgeos/74038)

<div class="topic-metadata">

**Author:** [@nbalasus](https://discourse.julialang.org/u/nbalasus)\
**Replies:** 10\
**Last updated:** [January 7, 2022, 4:41am UTC](https://discourse.julialang.org/t/improving-performance-on-nested-for-loops-sparsearrays-libgeos/74038 "2022-01-07T04:41:15Z")

</div>

I have two arrays of polygons, one with 9,000,000 polygons and the other with 60,000 polygons. I would like to find the intersecting area of each of these. In the MWE example below where I have reduced the example to 201…

---

## [How make a true distributed program](https://discourse.julialang.org/t/how-make-a-true-distributed-program/73919)

<div class="topic-metadata">

**Author:** [@GalloLuigi](https://discourse.julialang.org/u/GalloLuigi)\
**Replies:** 5\
**Last updated:** [January 5, 2022, 4:18pm UTC](https://discourse.julialang.org/t/how-make-a-true-distributed-program/73919 "2022-01-05T16:18:31Z")

</div>

Hi on my local machine i have a program like this : using Distributed @distributed for(...) # some code end I want to “distribute” the for iterations to some remote virtual machines. How can I do it?

---

## [Is this the maximum perf i can obtain?](https://discourse.julialang.org/t/is-this-the-maximum-perf-i-can-obtain/74022)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 10\
**Last updated:** [January 5, 2022, 9:55am UTC](https://discourse.julialang.org/t/is-this-the-maximum-perf-i-can-obtain/74022 "2022-01-05T09:55:25Z")

</div>

Hi, I have a simple operation to make, which represents 80% of my runtime. I am trying to make it as fast as possible… Here is the sketch of the problem : using Statistics, BenchmarkTools function exp\_and\_mean!(slack,D…

---

## [Could this kernel go faster?](https://discourse.julialang.org/t/could-this-kernel-go-faster/73986)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 3\
**Last updated:** [January 4, 2022, 9:50am UTC](https://discourse.julialang.org/t/could-this-kernel-go-faster/73986 "2022-01-04T09:50:46Z")

</div>

Hi, I have the follwing problem : using Statistics, BenchmarkTools, ProfileView function compute\_exp\_moments!(mu,D,e,slack,data) data .= D'e # most expensive line according to profileview. slack .= exp.(.-dat…

---

## [Lazy.jl list overhead](https://discourse.julialang.org/t/lazy-jl-list-overhead/73958)

<div class="topic-metadata">

**Author:** [@jekyllstein](https://discourse.julialang.org/u/jekyllstein)\
**Replies:** 0\
**Last updated:** [January 3, 2022, 11:39am UTC](https://discourse.julialang.org/t/lazy-jl-list-overhead/73958 "2022-01-03T11:39:19Z")

</div>

I was experimenting with Lazy.jl and was wondering why there was significant overhead for accessing the first item of a list with a sufficiently complicated comprehension. function testlist(n) l = @lazy \[x^2 for x …

---

## [Squeezing performance out of ODE solves with interpolations](https://discourse.julialang.org/t/squeezing-performance-out-of-ode-solves-with-interpolations/73519)

<div class="topic-metadata">

**Author:** [@qtoloza](https://discourse.julialang.org/u/qtoloza)\
**Replies:** 6\
**Last updated:** [January 2, 2022, 9:31am UTC](https://discourse.julialang.org/t/squeezing-performance-out-of-ode-solves-with-interpolations/73519 "2022-01-02T09:31:10Z")

</div>

Hi all! I’m trying to squeeze performance gains out of two sets of ODEs that I need to solve many times at relatively low tolerances (~1e-10). I’ve benefited enormously from reading other posts and the performance tips …

---

## [Inversion and multiplication of sparse matrices](https://discourse.julialang.org/t/inversion-and-multiplication-of-sparse-matrices/73819)

<div class="topic-metadata">

**Author:** [@Rajesh\_Nakka](https://discourse.julialang.org/u/Rajesh_Nakka)\
**Replies:** 7\
**Last updated:** [December 30, 2021, 9:52pm UTC](https://discourse.julialang.org/t/inversion-and-multiplication-of-sparse-matrices/73819 "2021-12-30T21:52:21Z")

</div>

I have encountered a problem of the following kind. C = A^-1 \* B where A is a very large nxn sparse banded symmetric matrix (of SparseMatrixCSC type) and B is nx5 matrix. I have read on this forum and somewhere else…

---

## [Julia 1.7 on M1 is Incredible?](https://discourse.julialang.org/t/julia-1-7-on-m1-is-incredible/73498)

<div class="topic-metadata">

**Author:** [@cortner](https://discourse.julialang.org/u/cortner)\
**Replies:** 5\
**Last updated:** [December 29, 2021, 10:26pm UTC](https://discourse.julialang.org/t/julia-1-7-on-m1-is-incredible/73498 "2021-12-29T22:26:05Z")

</div>

I recently spent a day fixing performance bottlenecks from my group’s research code (not important I think but I’m referring to ACE.jl). I had some unexpected experiences and am hoping somebody will help me understand? I…

---

## [CUDA unexplainable SPEEDUP! Local memory?](https://discourse.julialang.org/t/cuda-unexplainable-speedup-local-memory/73754)

<div class="topic-metadata">

**Author:** [@Marcell\_Havlik](https://discourse.julialang.org/u/Marcell_Havlik)\
**Replies:** 4\
**Last updated:** [December 29, 2021, 3:35pm UTC](https://discourse.julialang.org/t/cuda-unexplainable-speedup-local-memory/73754 "2021-12-29T15:35:36Z")

</div>

Hey, I was trying to implement a kernel function when I faced with this incredible big difference: using BenchmarkTools using CUDA fast(v, nins,k,j,glay,glay2) = begin I = (blockIdx().x - 1) \* blockDim().x + threadIdx…

---

## [Is Pmap \_both\_ distributed and threaded?](https://discourse.julialang.org/t/is-pmap-both-distributed-and-threaded/73717)

<div class="topic-metadata">

**Author:** [@Chris\_Green](https://discourse.julialang.org/u/Chris_Green)\
**Replies:** 4\
**Last updated:** [December 28, 2021, 9:18pm UTC](https://discourse.julialang.org/t/is-pmap-both-distributed-and-threaded/73717 "2021-12-28T21:18:24Z")

</div>

My typical cluster setup is 20-60 48-core AWS nodes If I use pmap() to distribute work across them, will the cluster workers also distribute their chunk of the map operation among their threads?

---

## [How to make norm(::AbstractVector) faster in my case?](https://discourse.julialang.org/t/how-to-make-norm-abstractvector-faster-in-my-case/73711)

<div class="topic-metadata">

**Author:** [@ziyiyin97](https://discourse.julialang.org/u/ziyiyin97)\
**Replies:** 14\
**Last updated:** [December 28, 2021, 8:36pm UTC](https://discourse.julialang.org/t/how-to-make-norm-abstractvector-faster-in-my-case/73711 "2021-12-28T20:36:07Z")

</div>

import Base.size import Base.IndexStyle import Base.getindex import Base.setindex! using LinearAlgebra using BenchmarkTools struct Dummy{T} \<: AbstractVector{T} coeffs::Vector{T} end ############### Base ########…

---

## [How to pass compile-time user settings to macro?](https://discourse.julialang.org/t/how-to-pass-compile-time-user-settings-to-macro/73607)

<div class="topic-metadata">

**Author:** [@Chiil](https://discourse.julialang.org/u/Chiil)\
**Replies:** 8\
**Last updated:** [December 27, 2021, 7:36pm UTC](https://discourse.julialang.org/t/how-to-pass-compile-time-user-settings-to-macro/73607 "2021-12-27T19:36:45Z")

</div>

I have a module that develops a kernel using a macro based on settings that a user provides. I need those settings to be compile time available, otherwise the macro won’t work. In this current example, I do this with con…

---

## [Block number conversion during bit operations](https://discourse.julialang.org/t/block-number-conversion-during-bit-operations/73640)

<div class="topic-metadata">

**Author:** [@Jakub\_Mitura](https://discourse.julialang.org/u/Jakub_Mitura)\
**Replies:** 1\
**Last updated:** [December 27, 2021, 2:15am UTC](https://discourse.julialang.org/t/block-number-conversion-during-bit-operations/73640 "2021-12-27T02:15:02Z")

</div>

Hello I am working on problem when I use UInt32 as a bitAttay of 32 entries - (I can not use Bitarray for some reasons) problem is that sometimes (once every couple hundred iterations) when I modify the first bit it lead…

---

## [Filtering keys out of named tuples](https://discourse.julialang.org/t/filtering-keys-out-of-named-tuples/73564)

<div class="topic-metadata">

**Author:** [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Replies:** 9\
**Last updated:** [December 26, 2021, 7:29pm UTC](https://discourse.julialang.org/t/filtering-keys-out-of-named-tuples/73564 "2021-12-26T19:29:05Z")

</div>

What’s the right way to filter a key out of a named tuple? Example: nt = (;a = 1, b = 2) filter(x-\>x\[1\] == :a,nt) # Errors filter(x-\>x\[1\] == :a,Base.Pairs(nt,keys(nt))) # Allocates an entire dictionary What’s the right…

---

## [Us novices also want moar speed](https://discourse.julialang.org/t/us-novices-also-want-moar-speed/73510)

<div class="topic-metadata">

**Author:** [@g2g](https://discourse.julialang.org/u/g2g)\
**Replies:** 5\
**Last updated:** [December 26, 2021, 2:28pm UTC](https://discourse.julialang.org/t/us-novices-also-want-moar-speed/73510 "2021-12-26T14:28:10Z")

</div>

The following outline of an example would have helped me as I was trying to learn just enough of Julia’s parallel processing capabilities to speed up the generation of about 6000 frames in a 3D plot animation, which was …

---

## [Setup for Module/Package Testing](https://discourse.julialang.org/t/setup-for-module-package-testing/49236)

<div class="topic-metadata">

**Author:** [@Brad\_Carman](https://discourse.julialang.org/u/Brad_Carman)\
**Replies:** 6\
**Last updated:** [December 26, 2021, 12:46pm UTC](https://discourse.julialang.org/t/setup-for-module-package-testing/49236 "2021-12-26T12:46:14Z")

</div>

I’m developing a private package and I’m curious what the recommend process is. I started with the idea of using Pkg.develop(path=“path to my package”) but I’ve noticed that with this method I often need to restart the …

---

## [Why is Julia not inferring the output type of f(x,y)=x+y?](https://discourse.julialang.org/t/why-is-julia-not-inferring-the-output-type-of-f-x-y-x-y/73634)

<div class="topic-metadata">

**Author:** [@vedantroy](https://discourse.julialang.org/u/vedantroy)\
**Replies:** 11\
**Last updated:** [December 26, 2021, 6:27am UTC](https://discourse.julialang.org/t/why-is-julia-not-inferring-the-output-type-of-f-x-y-x-y/73634 "2021-12-26T06:27:55Z")

</div>

I’m playing around with type inference in Julia. I have the following simple function: f(x,y) = x+y function q2() x = Number\[1.0,3\] a = 4 b = 2 c = f(x\[1\],a) d = f(b,c) f(d,x\[2\]) end @code\_warntype q2() He…

---

## [Why does using + instead of += double the number of allocations?](https://discourse.julialang.org/t/why-does-using-instead-of-double-the-number-of-allocations/73630)

<div class="topic-metadata">

**Author:** [@vedantroy](https://discourse.julialang.org/u/vedantroy)\
**Replies:** 3\
**Last updated:** [December 26, 2021, 12:50am UTC](https://discourse.julialang.org/t/why-does-using-instead-of-double-the-number-of-allocations/73630 "2021-12-26T00:50:02Z")

</div>

I have the following code that I’m playing around with (taken from here): function vectorized() a = \[1.0, 1.0\] b = \[2.0, 2.0\] x = \[0, 0\] for i in 1:1000 x = a + b end return x end @bti…

---

## [Issue with LSTM with Flux](https://discourse.julialang.org/t/issue-with-lstm-with-flux/73563)

<div class="topic-metadata">

**Author:** [@Vishal\_Sharma1](https://discourse.julialang.org/u/Vishal_Sharma1)\
**Replies:** 0\
**Last updated:** [December 23, 2021, 11:54pm UTC](https://discourse.julialang.org/t/issue-with-lstm-with-flux/73563 "2021-12-23T23:54:41Z")

</div>

I am new to Flux and trying to get LSTM model for a time series prediction working but currently stuck at an error which I dont seem to understand. train\_data, train\_labels, test\_data, test\_labels = getData(df) model …

---

## [Brackets on structures Julia](https://discourse.julialang.org/t/brackets-on-structures-julia/73532)

<div class="topic-metadata">

**Author:** [@Leticia-maria](https://discourse.julialang.org/u/Leticia-maria)\
**Replies:** 1\
**Last updated:** [December 23, 2021, 2:17pm UTC](https://discourse.julialang.org/t/brackets-on-structures-julia/73532 "2021-12-23T14:17:12Z")

</div>

what means this brackets on struct?: struct Graph{T} adjacency\_lists :: Dict{T, Set{T}} edge\_weights :: Dict{Tuple{T, T}, Float64} end

---

## [When is a fold over a fixed-length tuple unrolled?](https://discourse.julialang.org/t/when-is-a-fold-over-a-fixed-length-tuple-unrolled/73410)

<div class="topic-metadata">

**Author:** [@matthias314](https://discourse.julialang.org/u/matthias314)\
**Replies:** 6\
**Last updated:** [December 22, 2021, 1:35am UTC](https://discourse.julialang.org/t/when-is-a-fold-over-a-fixed-length-tuple-unrolled/73410 "2021-12-22T01:35:05Z")

</div>

@code\_typed tells me that the statement foldl(+, (1,2,3); init = 0) is unrolled into three additions. On the other hand, if I say struct A x::Int; y::Int; z::Int end f(a::A) = foldl((1,2,3); init = UInt(0)) do h, i …

---

## [How to (efficiently) find the set of maxima of an array?](https://discourse.julialang.org/t/how-to-efficiently-find-the-set-of-maxima-of-an-array/73423)

<div class="topic-metadata">

**Author:** [@user\_231578](https://discourse.julialang.org/u/user_231578)\
**Replies:** 6\
**Last updated:** [December 21, 2021, 11:55am UTC](https://discourse.julialang.org/t/how-to-efficiently-find-the-set-of-maxima-of-an-array/73423 "2021-12-21T11:55:56Z")

</div>

I want to find the set of maxima of an array. More precisely, I want the set of their indices. For example, from A = \[1 2 3 4 1 2 3 4 1 2 3 4\] I want to obtain something similar to 3-element Vector{Int64}: 4 8 1…

---

## [DFbetas for identifying influential participants - linear mixed models](https://discourse.julialang.org/t/dfbetas-for-identifying-influential-participants-linear-mixed-models/73399)

<div class="topic-metadata">

**Author:** [@CatOliveira](https://discourse.julialang.org/u/CatOliveira)\
**Replies:** 1\
**Last updated:** [December 20, 2021, 11:23pm UTC](https://discourse.julialang.org/t/dfbetas-for-identifying-influential-participants-linear-mixed-models/73399 "2021-12-20T23:23:10Z")

</div>

Hello everyone, I have used the package influence.me to determine whether I had influential participants using dfbetas. Yet, this package takes forever to run and I just can’t wait another month for it to run. I tried t…

---

## [Inference problem with @spawn](https://discourse.julialang.org/t/inference-problem-with-spawn/73379)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 5\
**Last updated:** [December 20, 2021, 5:39pm UTC](https://discourse.julialang.org/t/inference-problem-with-spawn/73379 "2021-12-20T17:39:00Z")

</div>

This is a toy example of the problem. I want to sum a bunch of number is parallel, using a lock to reduce. Disconsidering the fact that the lock here is of course detrimental to performance (the actual use case is diffe…

---

## [Nested multi-thread](https://discourse.julialang.org/t/nested-multi-thread/73073)

<div class="topic-metadata">

**Author:** [@juliauser](https://discourse.julialang.org/u/juliauser)\
**Replies:** 13\
**Last updated:** [December 19, 2021, 8:01pm UTC](https://discourse.julialang.org/t/nested-multi-thread/73073 "2021-12-19T20:01:53Z")

</div>

I have N groups. For each group I have J\*K options for each agent i. I want to find the maximum over j,k for each I, and do so for each group n. The problems are all separate from each others. Threads.@threads…

---

## [Performance benefits of multiple dispatch](https://discourse.julialang.org/t/performance-benefits-of-multiple-dispatch/73254)

<div class="topic-metadata">

**Author:** [@Niall](https://discourse.julialang.org/u/Niall)\
**Replies:** 20\
**Last updated:** [December 19, 2021, 1:03pm UTC](https://discourse.julialang.org/t/performance-benefits-of-multiple-dispatch/73254 "2021-12-19T13:03:14Z")

</div>

OK, so I thought it’d be a great idea to demonstrate to students on their very first lesson the performance benefits of Julia’s Top Notion: multiple dispatch. So I wrote the program shown below. Only problem is, the resu…

---

## [I Have a dream! a Green dream -- Does Julia save energy?](https://discourse.julialang.org/t/i-have-a-dream-a-green-dream-does-julia-save-energy/73188)

<div class="topic-metadata">

**Author:** [@SonOfSun](https://discourse.julialang.org/u/SonOfSun)\
**Replies:** 21\
**Last updated:** [December 18, 2021, 4:34pm UTC](https://discourse.julialang.org/t/i-have-a-dream-a-green-dream-does-julia-save-energy/73188 "2021-12-18T16:34:37Z")

</div>

This is not much of a question, more like a possible way to get some more attention to the Julia language. Everybody is talking about we need to save the planet and use less energy. I think it could be a great way to p…

---

## [Package import order change load time](https://discourse.julialang.org/t/package-import-order-change-load-time/73220)

<div class="topic-metadata">

**Author:** [@albheim](https://discourse.julialang.org/u/albheim)\
**Replies:** 2\
**Last updated:** [December 18, 2021, 4:07pm UTC](https://discourse.julialang.org/t/package-import-order-change-load-time/73220 "2021-12-18T16:07:59Z")

</div>

It seems like the order of loading packages can have some impact on the time, mostly got curious about why this happened. Looking at two packages for different load configurations I get albheim@gilbert ~\> hyperfine "ju…

---

## [Profile garbage collection?](https://discourse.julialang.org/t/profile-garbage-collection/73263)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 3\
**Last updated:** [December 18, 2021, 5:36am UTC](https://discourse.julialang.org/t/profile-garbage-collection/73263 "2021-12-18T05:36:24Z")

</div>

Is there a way to profile the garbage collection? For example, to trace which are the variables that are being collected?

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

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