# Performance

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

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

**Page:** 77

---

## [Most Efficient Way to Update and Array/Variable?](https://discourse.julialang.org/t/most-efficient-way-to-update-and-array-variable/72606)

<div class="topic-metadata">

**Author:** [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)\
**Replies:** 8\
**Last updated:** [December 6, 2021, 10:53am UTC](https://discourse.julialang.org/t/most-efficient-way-to-update-and-array-variable/72606 "2021-12-06T10:53:22Z")

</div>

Hi all! First of all, thanks for reading. I am trying to enhance the performance of this function and I wonder if there is a more Julian way to write it in order to make it faster! I have 4 variables that I update ins…

---

## [HoJ bot : Heroku Memory quota exceed](https://discourse.julialang.org/t/hoj-bot-heroku-memory-quota-exceed/61194)

<div class="topic-metadata">

**Author:** [@Ashwani\_Rathee](https://discourse.julialang.org/u/Ashwani_Rathee)\
**Replies:** 5\
**Last updated:** [December 6, 2021, 8:27am UTC](https://discourse.julialang.org/t/hoj-bot-heroku-memory-quota-exceed/61194 "2021-12-06T08:27:48Z")

</div>

Fellow Julians : I was trying to put HoJ(Humans of Julia) bot on heroku, but memory quota exceeded issue keeps arising. Yeah, atleast with the free tier that’s the case. Though I think in general it would be awesome to…

---

## [Sparse matrix assembly with bad timings](https://discourse.julialang.org/t/sparse-matrix-assembly-with-bad-timings/72584)

<div class="topic-metadata">

**Author:** [@Bardo](https://discourse.julialang.org/u/Bardo)\
**Replies:** 2\
**Last updated:** [December 4, 2021, 5:52pm UTC](https://discourse.julialang.org/t/sparse-matrix-assembly-with-bad-timings/72584 "2021-12-04T17:52:43Z")

</div>

Hi, I took the 2016 codes from Julia iFEM 2: Optimizing Stiffness Matrix Assembly and made some cosmetic changes to run them with Julia 1.7. Chris’ old timings were: tic; assemblingstandard(node,elem); toc; tic; assem…

---

## [Forward- and reverse-mode AD comparisons with JAX](https://discourse.julialang.org/t/forward-and-reverse-mode-ad-comparisons-with-jax/72379)

<div class="topic-metadata">

**Author:** [@wil-j-wil](https://discourse.julialang.org/u/wil-j-wil)\
**Replies:** 7\
**Last updated:** [December 4, 2021, 11:16am UTC](https://discourse.julialang.org/t/forward-and-reverse-mode-ad-comparisons-with-jax/72379 "2021-12-04T11:16:53Z")

</div>

I have been attempting to compute the gradients of a covariance function (kernel) in Julia. I was initially using Zygote, incorrectly since forward-mode is much better suited to my task. However this resulted in some int…

---

## [Count occurrences of columns in a 2d array (using countmap)](https://discourse.julialang.org/t/count-occurrences-of-columns-in-a-2d-array-using-countmap/44023)

<div class="topic-metadata">

**Author:** [@roi.holtzman](https://discourse.julialang.org/u/roi.holtzman)\
**Replies:** 13\
**Last updated:** [December 3, 2021, 11:37pm UTC](https://discourse.julialang.org/t/count-occurrences-of-columns-in-a-2d-array-using-countmap/44023 "2021-12-03T23:37:29Z")

</div>

I have a 2d BitArray and I want to count the number of distinct columns in that array. And I want to do it fast. I guess that countmap (of StatsBase) is the most efficient way for such operations. However it only works…

---

## [Draw two distinct random integers from \`1:n\`](https://discourse.julialang.org/t/draw-two-distinct-random-integers-from-1-n/72289)

<div class="topic-metadata">

**Author:** [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Replies:** 24\
**Last updated:** [December 3, 2021, 2:09pm UTC](https://discourse.julialang.org/t/draw-two-distinct-random-integers-from-1-n/72289 "2021-12-03T14:09:47Z")

</div>

I’m looking for a fast and elegant way to repeatedly draw two distinct random integers from the range 1:n. A naive baseline: julia\> function draw(n, iter) …

---

## [Extremely high first call latency Julia 1.6 versus 1.5 with multiphysics PDE solver](https://discourse.julialang.org/t/extremely-high-first-call-latency-julia-1-6-versus-1-5-with-multiphysics-pde-solver/71692)

<div class="topic-metadata">

**Author:** [@amartinhuertas](https://discourse.julialang.org/u/amartinhuertas)\
**Replies:** 27\
**Last updated:** [December 2, 2021, 8:03am UTC](https://discourse.julialang.org/t/extremely-high-first-call-latency-julia-1-6-versus-1-5-with-multiphysics-pde-solver/71692 "2021-12-02T08:03:02Z")

</div>

Dear all, we are experiencing extremely high first call latency times with Julia 1.6 when running our geophysical flows multiphysics finite element PDE solver (on the order of 15 hours on a supercomputer node with 192 G…

---

## [M1 vs. M1Pro vs. M1Max For DiffEq & Optim](https://discourse.julialang.org/t/m1-vs-m1pro-vs-m1max-for-diffeq-optim/72418)

<div class="topic-metadata">

**Author:** [@donkeysaddle](https://discourse.julialang.org/u/donkeysaddle)\
**Replies:** 0\
**Last updated:** [December 1, 2021, 11:00pm UTC](https://discourse.julialang.org/t/m1-vs-m1pro-vs-m1max-for-diffeq-optim/72418 "2021-12-01T23:00:55Z")

</div>

I think I will experience a performance boost with any of the Arm Macs but I was curious to hear people’s experiences particularly as it pertains to DifferentialEquations.jl and Optim.jl. My question is quite vague becau…

---

## [Makie Scatter Plot recipe for vector of custom types](https://discourse.julialang.org/t/makie-scatter-plot-recipe-for-vector-of-custom-types/72255)

<div class="topic-metadata">

**Author:** [@Allan\_Baker](https://discourse.julialang.org/u/Allan_Baker)\
**Replies:** 5\
**Last updated:** [December 1, 2021, 7:05pm UTC](https://discourse.julialang.org/t/makie-scatter-plot-recipe-for-vector-of-custom-types/72255 "2021-12-01T19:05:14Z")

</div>

This should be easy. At least it was for plots. I don’t understand what I am doing wrong. Looking for a simple example that shows me how to use convert\_arguments. I think the documentation makes too many assumptions …

---

## [Huge performance fluctuations in parallel benchmark: insights?](https://discourse.julialang.org/t/huge-performance-fluctuations-in-parallel-benchmark-insights/67953)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 52\
**Last updated:** [December 1, 2021, 4:28pm UTC](https://discourse.julialang.org/t/huge-performance-fluctuations-in-parallel-benchmark-insights/67953 "2021-12-01T16:28:17Z")

</div>

I have the following scenario. The function I am evaluating uses multi-threading, and it takes 5 to 6s to finish. But sometimes, to do exactly the same thing, it takes 2, 3 times that time. The machine is not running any…

---

## [Multi-threading or multi-processing, how to know which to use and when?](https://discourse.julialang.org/t/multi-threading-or-multi-processing-how-to-know-which-to-use-and-when/72278)

<div class="topic-metadata">

**Author:** [@Lamma](https://discourse.julialang.org/u/Lamma)\
**Replies:** 32\
**Last updated:** [December 1, 2021, 3:23pm UTC](https://discourse.julialang.org/t/multi-threading-or-multi-processing-how-to-know-which-to-use-and-when/72278 "2021-12-01T15:23:52Z")

</div>

I am wanting to run a simple for loop that is writing certain lines from a very large file to a new file based on a if check of pre computed criteria. reader = FASTA.Reader(GzipDecompressorStream(open("/home/people/robm…

---

## [Strange allocations in broadcasting (with \`^\`?)](https://discourse.julialang.org/t/strange-allocations-in-broadcasting-with/72229)

<div class="topic-metadata">

**Author:** [@johnomotani](https://discourse.julialang.org/u/johnomotani)\
**Replies:** 3\
**Last updated:** [December 1, 2021, 11:51am UTC](https://discourse.julialang.org/t/strange-allocations-in-broadcasting-with/72229 "2021-12-01T11:51:16Z")

</div>

I think d ^ 2 should be optimized into just d \* d (here), so the following two operations should be identical, but the form with ^ allocates with the one with \* does not: julia\> using BenchmarkTools julia\> const a = ra…

---

## [Mapreduce for binary operations on SparseVector](https://discourse.julialang.org/t/mapreduce-for-binary-operations-on-sparsevector/72173)

<div class="topic-metadata">

**Author:** [@jlapeyre](https://discourse.julialang.org/u/jlapeyre)\
**Replies:** 3\
**Last updated:** [November 30, 2021, 11:38pm UTC](https://discourse.julialang.org/t/mapreduce-for-binary-operations-on-sparsevector/72173 "2021-11-30T23:38:10Z")

</div>

SparseArrays has support for mapping a binary function over two SparseVectors. For example here. But, I don’t see similar support for mapreduce. The function linked above can be modified to reduce the output vector as …

---

## [Backslash operator "\\" works differently in REPL versus in function?](https://discourse.julialang.org/t/backslash-operator-works-differently-in-repl-versus-in-function/72318)

<div class="topic-metadata">

**Author:** [@GlenHenshaw](https://discourse.julialang.org/u/GlenHenshaw)\
**Replies:** 2\
**Last updated:** [November 30, 2021, 8:57pm UTC](https://discourse.julialang.org/t/backslash-operator-works-differently-in-repl-versus-in-function/72318 "2021-11-30T20:57:12Z")

</div>

I have two Array{Float32,2} variables, X1 and X2. Both are 5 by 949. In the REPL, this works: Julia\> X2\\X1 949x949 Array{Float32,2}: \<lots of stuff\> which is what I expect and want. but doing the exact same operation…

---

## [Spurious memory allocation even though @code\_warntype looks fine (no types marked in red)](https://discourse.julialang.org/t/spurious-memory-allocation-even-though-code-warntype-looks-fine-no-types-marked-in-red/22367)

<div class="topic-metadata">

**Author:** [@fverdugo](https://discourse.julialang.org/u/fverdugo)\
**Replies:** 7\
**Last updated:** [November 30, 2021, 4:24pm UTC](https://discourse.julialang.org/t/spurious-memory-allocation-even-though-code-warntype-looks-fine-no-types-marked-in-red/22367 "2021-11-30T16:24:14Z")

</div>

I have trouble with this piece of code: struct Foo{T,N} a::Array{T,N} l::Int end function Base.iterate(foo::Foo{T,N}) where {T,N} v = Array{Float64,N}(undef,size(foo.a)) k = 0 if k == foo.l; return n…

---

## [Strange way to recover performance with polymorphic types](https://discourse.julialang.org/t/strange-way-to-recover-performance-with-polymorphic-types/72250)

<div class="topic-metadata">

**Author:** [@peremato](https://discourse.julialang.org/u/peremato)\
**Replies:** 5\
**Last updated:** [November 30, 2021, 8:57am UTC](https://discourse.julialang.org/t/strange-way-to-recover-performance-with-polymorphic-types/72250 "2021-11-30T08:57:43Z")

</div>

This is a followup of dramatic performance change by adding additional unused method. The explanation was the existing limit on the number of overloaded methods the Julia optimizer is looking to decide the actual return …

---

## [Performance of custom lt function in sort!](https://discourse.julialang.org/t/performance-of-custom-lt-function-in-sort/72264)

<div class="topic-metadata">

**Author:** [@Ian\_Slagle](https://discourse.julialang.org/u/Ian_Slagle)\
**Replies:** 2\
**Last updated:** [November 30, 2021, 2:43am UTC](https://discourse.julialang.org/t/performance-of-custom-lt-function-in-sort/72264 "2021-11-30T02:43:21Z")

</div>

I am interested in writing my own lt function within a sort for better performance in a specific use case (in this case, I only care if the numbers are a set length apart from one another). However, it seems that any sub…

---

## [Performance of simple broadcasting operations with many arguments](https://discourse.julialang.org/t/performance-of-simple-broadcasting-operations-with-many-arguments/72213)

<div class="topic-metadata">

**Author:** [@Marco\_Lombardi](https://discourse.julialang.org/u/Marco_Lombardi)\
**Replies:** 15\
**Last updated:** [November 29, 2021, 10:09pm UTC](https://discourse.julialang.org/t/performance-of-simple-broadcasting-operations-with-many-arguments/72213 "2021-11-29T22:09:48Z")

</div>

I am puzzled by some microbenchmarks tests I did on very simple broadcasting operations. julia\> using BenchmarkTools julia\> n = 10000; x = rand(n); y = rand(n); z = rand(n); t = rand(n); r = zeros(n); julia\> @belapsed $…

---

## [Why use Julia to build an Earth System Model?](https://discourse.julialang.org/t/why-use-julia-to-build-an-earth-system-model/53180)

<div class="topic-metadata">

**Author:** [@AlexisRenchon](https://discourse.julialang.org/u/AlexisRenchon)\
**Replies:** 3\
**Last updated:** [November 28, 2021, 8:54pm UTC](https://discourse.julialang.org/t/why-use-julia-to-build-an-earth-system-model/53180 "2021-11-28T20:54:36Z")

</div>

Hi all, Most Earth System Models are written in Fortran, but may be re-written in another language because Fortran has some issues running on GPU based supercomputer. Some consider using C instead, but there are many a…

---

## [Summing a vector of vectors in a non-allocating way](https://discourse.julialang.org/t/summing-a-vector-of-vectors-in-a-non-allocating-way/72161)

<div class="topic-metadata">

**Author:** [@jacobusmmsmit](https://discourse.julialang.org/u/jacobusmmsmit)\
**Replies:** 10\
**Last updated:** [November 27, 2021, 7:57pm UTC](https://discourse.julialang.org/t/summing-a-vector-of-vectors-in-a-non-allocating-way/72161 "2021-11-27T19:57:57Z")

</div>

What’s going wrong here, I get a DimensionMismatch error when I run this: input = repeat(\[ones(2)\], 4) output = zeros(2) sum(input) # Gives a 2-element Vector{Float64} sum!(output, input) # Gives a DimensionMismatch err…

---

## [Simple benchmark for CVS.jl v0.9.11 in Julia 1.6.4](https://discourse.julialang.org/t/simple-benchmark-for-cvs-jl-v0-9-11-in-julia-1-6-4/72140)

<div class="topic-metadata">

**Author:** [@KZiemian](https://discourse.julialang.org/u/KZiemian)\
**Replies:** 1\
**Last updated:** [November 26, 2021, 11:24pm UTC](https://discourse.julialang.org/t/simple-benchmark-for-cvs-jl-v0-9-11-in-julia-1-6-4/72140 "2021-11-26T23:24:47Z")

</div>

I try to learn some data science in Julia from Julia Academy’s Julia for Data Science and simple benchmark from it is quite surprising for me. I made its code below compact and probably use more packages that it need, ju…

---

## [Problem with Kaledio and admin rights](https://discourse.julialang.org/t/problem-with-kaledio-and-admin-rights/72110)

<div class="topic-metadata">

**Author:** [@mottelet](https://discourse.julialang.org/u/mottelet)\
**Replies:** 0\
**Last updated:** [November 26, 2021, 1:24pm UTC](https://discourse.julialang.org/t/problem-with-kaledio-and-admin-rights/72110 "2021-11-26T13:24:18Z")

</div>

Hi, I have made some tests (Julia 1.6.4) with a normal user account under Mac OS and Kaleido does not start,although it starts when the user is admin: julia\> using Plots julia\> plotlyjs() Plots.┌ Warning: Kaleido is n…

---

## [How to cut down compile time when inference is not the problem?](https://discourse.julialang.org/t/how-to-cut-down-compile-time-when-inference-is-not-the-problem/59077)

<div class="topic-metadata">

**Author:** [@fverdugo](https://discourse.julialang.org/u/fverdugo)\
**Replies:** 4\
**Last updated:** [November 26, 2021, 8:13am UTC](https://discourse.julialang.org/t/how-to-cut-down-compile-time-when-inference-is-not-the-problem/59077 "2021-11-26T08:13:33Z")

</div>

Background In Gridap.jl, we have experienced a significant increase in compile times when moving from Julia 1.5 to Julia 1.6. To illustrate this, consider this example: using Gridap function main() domain = (0,1,0,1,…

---

## [Deinterleave data](https://discourse.julialang.org/t/deinterleave-data/72013)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 12\
**Last updated:** [November 25, 2021, 1:26pm UTC](https://discourse.julialang.org/t/deinterleave-data/72013 "2021-11-25T13:26:37Z")

</div>

I am de-interleaving data that has been stored as a vector. I would like to store the data as a matrix. I have tried and performance tested 3 methods, and am looking for any comments on how to improve it. And example …

---

## [Rationale for adding singleton dim](https://discourse.julialang.org/t/rationale-for-adding-singleton-dim/72053)

<div class="topic-metadata">

**Author:** [@mottelet](https://discourse.julialang.org/u/mottelet)\
**Replies:** 3\
**Last updated:** [November 25, 2021, 11:17am UTC](https://discourse.julialang.org/t/rationale-for-adding-singleton-dim/72053 "2021-11-25T11:17:16Z")

</div>

Hi. What is the rationale for adding a singleton dimension in the following commands: julia\> A=rand(3,3);A\[:,\[2 1 3\]\] 3×1×3 Array{Float64, 3}: \[:, :, 1\] = 0.7056166212562252 0.6016873438276988 0.8375543887468311 \[:…

---

## [Why is printing to a terminal slow?](https://discourse.julialang.org/t/why-is-printing-to-a-terminal-slow/42987)

<div class="topic-metadata">

**Author:** [@asmar](https://discourse.julialang.org/u/asmar)\
**Replies:** 28\
**Last updated:** [November 24, 2021, 4:25pm UTC](https://discourse.julialang.org/t/why-is-printing-to-a-terminal-slow/42987 "2021-11-24T16:25:33Z")

</div>

Hello, I tried just a simple benchmark of printing a million numbers in an array. Surprisingly, it takes a lot of time. I imagine this might be connected to how julia communicates with the system, printing parts not th…

---

## [Dramatic performance change by adding additional unused method](https://discourse.julialang.org/t/dramatic-performance-change-by-adding-additional-unused-method/71771)

<div class="topic-metadata">

**Author:** [@peremato](https://discourse.julialang.org/u/peremato)\
**Replies:** 33\
**Last updated:** [November 23, 2021, 5:21pm UTC](https://discourse.julialang.org/t/dramatic-performance-change-by-adding-additional-unused-method/71771 "2021-11-23T17:21:22Z")

</div>

This is a followup of not-understanding-linear-growing-allocations. It took me a while to get a manageable reproducer after my first attempt of forgetting a simple const in a type alias. The code is as follows: using Be…

---

## [Serial synchronization issue and request for some general advice](https://discourse.julialang.org/t/serial-synchronization-issue-and-request-for-some-general-advice/71921)

<div class="topic-metadata">

**Author:** [@zchris9](https://discourse.julialang.org/u/zchris9)\
**Replies:** 1\
**Last updated:** [November 23, 2021, 7:44am UTC](https://discourse.julialang.org/t/serial-synchronization-issue-and-request-for-some-general-advice/71921 "2021-11-23T07:44:51Z")

</div>

Dear Julia Community! I am currently working on a university project where data is streamed to a Raspberry Pi 4 and needs to be processed in a soft real-time environment. The projects goal is to provide infrastructure f…

---

## [Not understanding linear growing allocations](https://discourse.julialang.org/t/not-understanding-linear-growing-allocations/71734)

<div class="topic-metadata">

**Author:** [@peremato](https://discourse.julialang.org/u/peremato)\
**Replies:** 27\
**Last updated:** [November 22, 2021, 4:35am UTC](https://discourse.julialang.org/t/not-understanding-linear-growing-allocations/71734 "2021-11-22T04:35:07Z")

</div>

I’m trying to understand why returning a tuple of static vectors have the effect of constantly growing allocations. I have the following code to demonstrate using BenchmarkTools using StaticArrays Vector2 = SVector{2}{…

---

## [\`mul\` dispatch to BLAS incomplete?](https://discourse.julialang.org/t/mul-dispatch-to-blas-incomplete/71831)

<div class="topic-metadata">

**Author:** [@goerch](https://discourse.julialang.org/u/goerch)\
**Replies:** 18\
**Last updated:** [November 22, 2021, 1:34am UTC](https://discourse.julialang.org/t/mul-dispatch-to-blas-incomplete/71831 "2021-11-22T01:34:06Z")

</div>

When translating the benchmark from Outperformed by Matlab using LinearAlgebra using MKL using BenchmarkTools function \_kron!(C::T1,A::T2,B::T3) where {T1 \<: AbstractVector,T2 \<: AbstractVector,T3 \<: AbstractVector} …

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

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