# Performance

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

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

**Page:** 79

---

## [Juno IDE in atom causing REPL to go with weird dots as follows](https://discourse.julialang.org/t/juno-ide-in-atom-causing-repl-to-go-with-weird-dots-as-follows/71120)

<div class="topic-metadata">

**Author:** [@yewalenikhil65](https://discourse.julialang.org/u/yewalenikhil65)\
**Replies:** 2\
**Last updated:** [November 10, 2021, 3:08am UTC](https://discourse.julialang.org/t/juno-ide-in-atom-causing-repl-to-go-with-weird-dots-as-follows/71120 "2021-11-10T03:08:25Z")

</div>

Is anyone else facing this issue with Juno IDE In atom ? image as follows for the REPL In juno. This happens mostly after computer is left ‘suspended’ or on sleep mode and then resumed

---

## [Why is advection\_shared! much faster than advection\_parallel!?](https://discourse.julialang.org/t/why-is-advection-shared-much-faster-than-advection-parallel/71231)

<div class="topic-metadata">

**Author:** [@DerongXu](https://discourse.julialang.org/u/DerongXu)\
**Replies:** 0\
**Last updated:** [November 9, 2021, 11:10pm UTC](https://discourse.julialang.org/t/why-is-advection-shared-much-faster-than-advection-parallel/71231 "2021-11-09T23:10:50Z")

</div>

Hi all, I am learning the parallel computing in Julia through the manual Multi-processing and Distributed Computing · The Julia Language In this page, why is advection\_shared! much faster than advection\_parallel! ? Bot…

---

## [Reducing allocations when subtracting vectors and multiplying by scalars](https://discourse.julialang.org/t/reducing-allocations-when-subtracting-vectors-and-multiplying-by-scalars/71203)

<div class="topic-metadata">

**Author:** [@jewh](https://discourse.julialang.org/u/jewh)\
**Replies:** 9\
**Last updated:** [November 9, 2021, 1:32pm UTC](https://discourse.julialang.org/t/reducing-allocations-when-subtracting-vectors-and-multiplying-by-scalars/71203 "2021-11-09T13:32:34Z")

</div>

Is it possible to re-write the following function foo(x, y), such that it only uses one allocation? using BenchmarkTools function foo(x::Vector{Float64}, y::Vector{Float64}) (x .- y) .\* 3.0 end This currently yie…

---

## [\[cluster\] Understanding parallel performance. Is GC triggered too early?](https://discourse.julialang.org/t/cluster-understanding-parallel-performance-is-gc-triggered-too-early/71197)

<div class="topic-metadata">

**Author:** [@carlo](https://discourse.julialang.org/u/carlo)\
**Replies:** 0\
**Last updated:** [November 9, 2021, 9:42am UTC](https://discourse.julialang.org/t/cluster-understanding-parallel-performance-is-gc-triggered-too-early/71197 "2021-11-09T09:42:15Z")

</div>

Good morning, everyone! After weeks of lurking in the forum to fix other of my problems (thanks, it’s a precious resource) I decided to go on and ask my own particular question. I am facing the following problem: I am …

---

## [Fastest possible trilinear interpolation with \`Interpolations.jl\`](https://discourse.julialang.org/t/fastest-possible-trilinear-interpolation-with-interpolations-jl/71184)

<div class="topic-metadata">

**Author:** [@Chiil](https://discourse.julialang.org/u/Chiil)\
**Replies:** 1\
**Last updated:** [November 9, 2021, 7:47am UTC](https://discourse.julialang.org/t/fastest-possible-trilinear-interpolation-with-interpolations-jl/71184 "2021-11-09T07:47:40Z")

</div>

I am working on developing a machine learning application in which two instances of our CFD code work simultaneously at different resolutions and data is passed between the two instances. For this, I need to have fastest…

---

## [Why does 'map' recompile each time?](https://discourse.julialang.org/t/why-does-map-recompile-each-time/71149)

<div class="topic-metadata">

**Author:** [@Iulian.Cioarca](https://discourse.julialang.org/u/Iulian.Cioarca)\
**Replies:** 4\
**Last updated:** [November 8, 2021, 4:10pm UTC](https://discourse.julialang.org/t/why-does-map-recompile-each-time/71149 "2021-11-08T16:10:44Z")

</div>

Consider the follosing example: y = \[1 2 3\] @time findall(map( x-\> x.== 3, y)) 0.077566 seconds (69.12 k allocations: 4.160 MiB, 13.08% gc time, 99.57% compilation time) 1-element Vector{CartesianIndex{2}}: CartesianI…

---

## [Type-instability in DifferentialEquations.jl](https://discourse.julialang.org/t/type-instability-in-differentialequations-jl/71141)

<div class="topic-metadata">

**Author:** [@Elyco](https://discourse.julialang.org/u/Elyco)\
**Replies:** 3\
**Last updated:** [November 8, 2021, 1:54pm UTC](https://discourse.julialang.org/t/type-instability-in-differentialequations-jl/71141 "2021-11-08T13:54:41Z")

</div>

Hi everyone, I’m trying to solve ODE many times each with different initial conditions, and I would like to optimize my code for that. I’ve tried to save in a (mutable) struct the solver in order to save time and the ne…

---

## [Issue with PDMP and Forwardiff - DifferentialEquation](https://discourse.julialang.org/t/issue-with-pdmp-and-forwardiff-differentialequation/17925)

<div class="topic-metadata">

**Author:** [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Replies:** 25\
**Last updated:** [November 8, 2021, 11:08am UTC](https://discourse.julialang.org/t/issue-with-pdmp-and-forwardiff-differentialequation/17925 "2021-11-08T11:08:57Z")

</div>

Hi, I repost here an issue posted in DifferentialEquations because I am not sure this issue concerns them entirely. In the following example, Forwardiff which is called from Rosenbrock23() fails. I spent quite some tim…

---

## [Why does Julia have around 200MB of memory overhead, even for small programs?](https://discourse.julialang.org/t/why-does-julia-have-around-200mb-of-memory-overhead-even-for-small-programs/71071)

<div class="topic-metadata">

**Author:** [@akriegman](https://discourse.julialang.org/u/akriegman)\
**Replies:** 5\
**Last updated:** [November 7, 2021, 9:03pm UTC](https://discourse.julialang.org/t/why-does-julia-have-around-200mb-of-memory-overhead-even-for-small-programs/71071 "2021-11-07T21:03:49Z")

</div>

I was looking at Julia’s performance in the Computer Language Benchmarks Game. Julia does pretty well in terms of speed, but I was noticing that Julia has a memory footprint of around 200MB for every benchmark, even ones…

---

## [Multiplying boolean matrices](https://discourse.julialang.org/t/multiplying-boolean-matrices/71086)

<div class="topic-metadata">

**Author:** [@e3c6](https://discourse.julialang.org/u/e3c6)\
**Replies:** 4\
**Last updated:** [November 7, 2021, 6:54pm UTC](https://discourse.julialang.org/t/multiplying-boolean-matrices/71086 "2021-11-07T18:54:29Z")

</div>

Why is there such a performance difference between multiplying float matrices and other kinds of matrices? I understand float matrices hit BLAS which is heavily optimized. But is this a fundamental difference or or just …

---

## [Benchmark function that uses CUDA.jl](https://discourse.julialang.org/t/benchmark-function-that-uses-cuda-jl/71093)

<div class="topic-metadata">

**Author:** [@UndefinedBehavior](https://discourse.julialang.org/u/UndefinedBehavior)\
**Replies:** 2\
**Last updated:** [November 7, 2021, 5:34pm UTC](https://discourse.julialang.org/t/benchmark-function-that-uses-cuda-jl/71093 "2021-11-07T17:34:56Z")

</div>

Hello all, I have created a function that computes the eigenvalues of large sparse matrices. I have implemented it both on CPU and GPU. I used CUDA.jl for portions of code that were computationally expensive. Now, I wan…

---

## [Function closure with large arrays/matrices scaling horribly](https://discourse.julialang.org/t/function-closure-with-large-arrays-matrices-scaling-horribly/71027)

<div class="topic-metadata">

**Author:** [@vivian-rogers](https://discourse.julialang.org/u/vivian-rogers)\
**Replies:** 6\
**Last updated:** [November 6, 2021, 3:19pm UTC](https://discourse.julialang.org/t/function-closure-with-large-arrays-matrices-scaling-horribly/71027 "2021-11-06T15:19:33Z")

</div>

Hi! So I am trying to set up a useful function f to pass around the rest of my code as follows: function f\_prepostproc(params) # do stuff f = f\_generator(params) # evaluate f at certain x values, save to file…

---

## [Why is sorting matrices allocating and why is it sometimes slower than the naive approach?](https://discourse.julialang.org/t/why-is-sorting-matrices-allocating-and-why-is-it-sometimes-slower-than-the-naive-approach/71015)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 11\
**Last updated:** [November 6, 2021, 2:53pm UTC](https://discourse.julialang.org/t/why-is-sorting-matrices-allocating-and-why-is-it-sometimes-slower-than-the-naive-approach/71015 "2021-11-06T14:53:30Z")

</div>

I noticed that sort! is allocating here: x = rand(10, 10); @time sort!(x, dims=1); # 0.000016 seconds (20 allocations: 960 bytes) And I’m not sure why. Here is the investigation I’ve done: using BenchmarkTools funct…

---

## [Collecting all solutions in a recursive branching algorithm](https://discourse.julialang.org/t/collecting-all-solutions-in-a-recursive-branching-algorithm/70936)

<div class="topic-metadata">

**Author:** [@Eugeleo](https://discourse.julialang.org/u/Eugeleo)\
**Replies:** 13\
**Last updated:** [November 5, 2021, 3:09pm UTC](https://discourse.julialang.org/t/collecting-all-solutions-in-a-recursive-branching-algorithm/70936 "2021-11-05T15:09:32Z")

</div>

Moved this from the New to Julia to a more fitting section I’m trying to translate a divide and conquer algorithm for a modified subset sum problem from Python. A simplified version might look like this: You are given a…

---

## [How to reduce memory allocations in the Sieve of Eratosthenes?](https://discourse.julialang.org/t/how-to-reduce-memory-allocations-in-the-sieve-of-eratosthenes/70679)

<div class="topic-metadata">

**Author:** [@vini-fda](https://discourse.julialang.org/u/vini-fda)\
**Replies:** 8\
**Last updated:** [November 5, 2021, 2:57pm UTC](https://discourse.julialang.org/t/how-to-reduce-memory-allocations-in-the-sieve-of-eratosthenes/70679 "2021-11-05T14:57:17Z")

</div>

Hello there! So I was trying to implement a cache-friendly version of the famous Sieve of Erathostenes in julia, and came up with this: function sieve\_cache\_optim(limit::UInt32; block\_size = 2^15) max\_primes = isqr…

---

## [Is there an in-place alternative to +=, \*=, etc.?](https://discourse.julialang.org/t/is-there-an-in-place-alternative-to-etc/70520)

<div class="topic-metadata">

**Author:** [@failedentertainment](https://discourse.julialang.org/u/failedentertainment)\
**Replies:** 1\
**Last updated:** [November 5, 2021, 3:47pm UTC](https://discourse.julialang.org/t/is-there-an-in-place-alternative-to-etc/70520 "2021-11-05T15:47:09Z")

</div>

Using += with arbitrary precision integers seems to end up using much more memory (and takes much longer) than the equivalent in-place operator (for my test, I used addeq! from Nemo and add! from Base.GMP.MPZ). Result: …

---

## [Improving performance of a number of functions for large scale gradient based optimization](https://discourse.julialang.org/t/improving-performance-of-a-number-of-functions-for-large-scale-gradient-based-optimization/70980)

<div class="topic-metadata">

**Author:** [@jmcastro2109](https://discourse.julialang.org/u/jmcastro2109)\
**Replies:** 11\
**Last updated:** [November 5, 2021, 2:59pm UTC](https://discourse.julialang.org/t/improving-performance-of-a-number-of-functions-for-large-scale-gradient-based-optimization/70980 "2021-11-05T14:59:30Z")

</div>

Hello, I am trying to conduct a large-scale Maximum Likelihood Estimation. Luckily, I have analytical gradients and Hessians and therefore I can speed up my optimization routine by using derivative based methods. Howev…

---

## [Where is the extra memory allocation?](https://discourse.julialang.org/t/where-is-the-extra-memory-allocation/70866)

<div class="topic-metadata">

**Author:** [@maphdze](https://discourse.julialang.org/u/maphdze)\
**Replies:** 11\
**Last updated:** [November 5, 2021, 1:49am UTC](https://discourse.julialang.org/t/where-is-the-extra-memory-allocation/70866 "2021-11-05T01:49:23Z")

</div>

I wrote a program several days ago, and the memory allocation is acceptable (2.79k allocations: 124.820MiB). Today, I add some new functions in it to implenment another feature. Then the memory allocation becomes much bi…

---

## [Finite element method interpolation performance](https://discourse.julialang.org/t/finite-element-method-interpolation-performance/70944)

<div class="topic-metadata">

**Author:** [@maphdze](https://discourse.julialang.org/u/maphdze)\
**Replies:** 3\
**Last updated:** [November 5, 2021, 12:52am UTC](https://discourse.julialang.org/t/finite-element-method-interpolation-performance/70944 "2021-11-05T00:52:26Z")

</div>

I have a question about the performance in interpolation in finite element method. In the Official Document, it is suggested to do small size array operations with StaticArrays.jl. In my finite element program, the glo…

---

## [How to improve the speed of "inpolygon"?](https://discourse.julialang.org/t/how-to-improve-the-speed-of-inpolygon/70969)

<div class="topic-metadata">

**Author:** [@leon](https://discourse.julialang.org/u/leon)\
**Replies:** 5\
**Last updated:** [November 4, 2021, 6:03pm UTC](https://discourse.julialang.org/t/how-to-improve-the-speed-of-inpolygon/70969 "2021-11-04T18:03:55Z")

</div>

I have about 30,000 pairs of longitude and latitude data (lon1 and lon2). My goal is to check if they will fall into a polygon defined by (lonW and latW). In Matlab, I can do this as below. It is blazing fast. It litera…

---

## [Shared memory computation inside of each task of parallel map](https://discourse.julialang.org/t/shared-memory-computation-inside-of-each-task-of-parallel-map/70927)

<div class="topic-metadata">

**Author:** [@tictaccat](https://discourse.julialang.org/u/tictaccat)\
**Replies:** 5\
**Last updated:** [November 4, 2021, 5:01pm UTC](https://discourse.julialang.org/t/shared-memory-computation-inside-of-each-task-of-parallel-map/70927 "2021-11-04T17:01:10Z")

</div>

Hi! I have a pretty simple problem: I have about 50 tasks I would like to do simultaneously, and I would like to do exploit shared memory parallelism on each task. I have control of about 50 nodes with about 40 CPUs eac…

---

## [Simple type problem](https://discourse.julialang.org/t/simple-type-problem/70958)

<div class="topic-metadata">

**Author:** [@Igor\_Douven](https://discourse.julialang.org/u/Igor_Douven)\
**Replies:** 2\
**Last updated:** [November 4, 2021, 3:07pm UTC](https://discourse.julialang.org/t/simple-type-problem/70958 "2021-11-04T15:07:08Z")

</div>

I have an abstract type, abstract type AT end and two mutable structs that are subtypes of AT: mutable struct S1 \<: AT #something end mutable struct S2 \<: AT #something end I would like to define a function …

---

## [Multithreading problem](https://discourse.julialang.org/t/multithreading-problem/70357)

<div class="topic-metadata">

**Author:** [@Jake](https://discourse.julialang.org/u/Jake)\
**Replies:** 10\
**Last updated:** [November 4, 2021, 12:03pm UTC](https://discourse.julialang.org/t/multithreading-problem/70357 "2021-11-04T12:03:13Z")

</div>

This is my first time trying to use multithreading for real work. I have an inner loop in my code for doing sinc interpolation of a recorded time history file. A minimum working example is # Minumum working example fo…

---

## [Alternative to very time-consuming array operations](https://discourse.julialang.org/t/alternative-to-very-time-consuming-array-operations/70620)

<div class="topic-metadata">

**Author:** [@anneJulia](https://discourse.julialang.org/u/anneJulia)\
**Replies:** 9\
**Last updated:** [November 4, 2021, 8:44am UTC](https://discourse.julialang.org/t/alternative-to-very-time-consuming-array-operations/70620 "2021-11-04T08:44:24Z")

</div>

I am writing a function where array operations, such as the example below, have to happen a few hundred thousand times. arr = \[1,0,0,1,1\] idx = \[2,4\] res = arr\[idx\] When using a profiler to analyse the code 89.69% of …

---

## [Get distances of many points within a max range, any performance improvements?](https://discourse.julialang.org/t/get-distances-of-many-points-within-a-max-range-any-performance-improvements/70917)

<div class="topic-metadata">

**Author:** [@Jon\_Norberg](https://discourse.julialang.org/u/Jon_Norberg)\
**Replies:** 8\
**Last updated:** [November 3, 2021, 11:56pm UTC](https://discourse.julialang.org/t/get-distances-of-many-points-within-a-max-range-any-performance-improvements/70917 "2021-11-03T23:56:23Z")

</div>

I have a potentially very long (N) set of points W with three dimensions. I need to make distance based calculations between all points within a set max distance. Below is my best attempt so far. Any performance improvem…

---

## [Improving Performance of a Loop](https://discourse.julialang.org/t/improving-performance-of-a-loop/70905)

<div class="topic-metadata">

**Author:** [@jmcastro2109](https://discourse.julialang.org/u/jmcastro2109)\
**Replies:** 9\
**Last updated:** [November 3, 2021, 8:12pm UTC](https://discourse.julialang.org/t/improving-performance-of-a-loop/70905 "2021-11-03T20:12:57Z")

</div>

Hi! I am trying to make the following function faster. Any suggestion would be very much appreciated. using Random using LinearAlgebra using BenchmarkTools ############################################################…

---

## [Why is a, b = rand(2) so bad?](https://discourse.julialang.org/t/why-is-a-b-rand-2-so-bad/70859)

<div class="topic-metadata">

**Author:** [@rakeshvar](https://discourse.julialang.org/u/rakeshvar)\
**Replies:** 9\
**Last updated:** [November 3, 2021, 5:46pm UTC](https://discourse.julialang.org/t/why-is-a-b-rand-2-so-bad/70859 "2021-11-03T17:46:10Z")

</div>

I am trying to find the Expected Value of maximum of two U\[0, 1\] RVs. Why is a call to rand(2) so much worse than two to rand(), rand()? julia\> function h(N) s = 0. for \_ in 1:N a, b…

---

## [Assigning values in for loop allocates memory](https://discourse.julialang.org/t/assigning-values-in-for-loop-allocates-memory/70851)

<div class="topic-metadata">

**Author:** [@Mikhail\_Kagalenko](https://discourse.julialang.org/u/Mikhail_Kagalenko)\
**Replies:** 3\
**Last updated:** [November 3, 2021, 5:00pm UTC](https://discourse.julialang.org/t/assigning-values-in-for-loop-allocates-memory/70851 "2021-11-03T17:00:28Z")

</div>

Why would that loop allocate anything at all? julia\> (M, N) = (512, 2048) A=zeros(M, N) v=zeros(M) @btime for k in 1:N v .= randn() A\[:, k\] = v end 2.502 ms (10756 allocat…

---

## [TimerOutputs and --track-allocation=user](https://discourse.julialang.org/t/timeroutputs-and-track-allocation-user/70884)

<div class="topic-metadata">

**Author:** [@Niceno](https://discourse.julialang.org/u/Niceno)\
**Replies:** 0\
**Last updated:** [November 3, 2021, 3:31pm UTC](https://discourse.julialang.org/t/timeroutputs-and-track-allocation-user/70884 "2021-11-03T15:31:15Z")

</div>

Dear all, I use TimerOutputs in my Julia code for profiling, but when I also want to check memory with --track-allocation=user option on start up, all the output is condensed in one line, the one with @timeit macro at t…

---

## [Stuck with another allocation question](https://discourse.julialang.org/t/stuck-with-another-allocation-question/70850)

<div class="topic-metadata">

**Author:** [@goerch](https://discourse.julialang.org/u/goerch)\
**Replies:** 2\
**Last updated:** [November 3, 2021, 8:46am UTC](https://discourse.julialang.org/t/stuck-with-another-allocation-question/70850 "2021-11-03T08:46:20Z")

</div>

The following program using BenchmarkTools const Example1 = Tuple{Int, Float64, Float64, Float64} const Example2 = Tuple{Int, Float64} function init!(v, n) for i in 1:n push!(v, (i, rand(), rand(), rand())…

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

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