# Performance

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

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

**Page:** 66

---

## [A safe inbounds use with great performance effect](https://discourse.julialang.org/t/a-safe-inbounds-use-with-great-performance-effect/81319)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 1\
**Last updated:** [May 19, 2022, 6:05pm UTC](https://discourse.julialang.org/t/a-safe-inbounds-use-with-great-performance-effect/81319 "2022-05-19T18:05:53Z")

</div>

As a followup from this: Matt has shown that enumerate(eachindex(a)) is quite fast: julia\> function f!(A) for (count, idx) in enumerate(eachindex(A)) A\[idx\] = count\*2 end e…

---

## [Parallel processing using FLoops](https://discourse.julialang.org/t/parallel-processing-using-floops/80893)

<div class="topic-metadata">

**Author:** [@devanshu](https://discourse.julialang.org/u/devanshu)\
**Replies:** 27\
**Last updated:** [May 19, 2022, 1:27pm UTC](https://discourse.julialang.org/t/parallel-processing-using-floops/80893 "2022-05-19T13:27:18Z")

</div>

Hi, I am trying to enhance the performance of my Julia code by using all the cores on my computer. For this, I am using the FLoops package. My code is simple: I am generating 100 instances of a random density matrix of s…

---

## [Fastest way to turn table into Array?](https://discourse.julialang.org/t/fastest-way-to-turn-table-into-array/81255)

<div class="topic-metadata">

**Author:** [@marianoarnaiz](https://discourse.julialang.org/u/marianoarnaiz)\
**Replies:** 5\
**Last updated:** [May 18, 2022, 3:51pm UTC](https://discourse.julialang.org/t/fastest-way-to-turn-table-into-array/81255 "2022-05-18T15:51:54Z")

</div>

Hi all. One if the main parts of my daily workflow makes me turn large tables to matrixes and or n-dims-arrays. For example: For a X Y Z Property table with 1 million+ lines, I do: Lat=-90:1:90 Long=-180:1:180 Zi=\[…

---

## [Reducing Genie latency](https://discourse.julialang.org/t/reducing-genie-latency/60550)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 2\
**Last updated:** [May 17, 2022, 5:22pm UTC](https://discourse.julialang.org/t/reducing-genie-latency/60550 "2022-05-17T17:22:49Z")

</div>

After running git clone https://github.com/GenieFramework/Genie.jl.git cd Genie.jl I run GENIE\_ENV=prod julia --project=. and \]instantiate. Then I can run the web server. julia\> using Genie; route(()-\>"hello world",…

---

## [Unable to eliminate an unwanted allocation](https://discourse.julialang.org/t/unable-to-eliminate-an-unwanted-allocation/80966)

<div class="topic-metadata">

**Author:** [@peremato](https://discourse.julialang.org/u/peremato)\
**Replies:** 23\
**Last updated:** [May 16, 2022, 3:35pm UTC](https://discourse.julialang.org/t/unable-to-eliminate-an-unwanted-allocation/80966 "2022-05-16T15:35:44Z")

</div>

I have spend several hours to eliminate a very elusive allocation that happens in a package that I intend to run on a GPU, which any allocation is fatal. I have tried all the standard methods to eliminate it (@code\_warnt…

---

## [Sparse solve vs BandedMatrix; time and allocation surprise](https://discourse.julialang.org/t/sparse-solve-vs-bandedmatrix-time-and-allocation-surprise/45119)

<div class="topic-metadata">

**Author:** [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Replies:** 29\
**Last updated:** [May 16, 2022, 9:47am UTC](https://discourse.julialang.org/t/sparse-solve-vs-bandedmatrix-time-and-allocation-surprise/45119 "2022-05-16T09:47:22Z")

</div>

I’m trying to understand why the SparseSuite \\ is so much worse than what I get with BandedMatrices. My test case, which reflects the results of my application, uses two matrices with the same elements, but stored diffe…

---

## [How to efficiently construct a large SparseArray? Packages for this?](https://discourse.julialang.org/t/how-to-efficiently-construct-a-large-sparsearray-packages-for-this/64863)

<div class="topic-metadata">

**Author:** [@Leo\_I](https://discourse.julialang.org/u/Leo_I)\
**Replies:** 20\
**Last updated:** [May 15, 2022, 12:16pm UTC](https://discourse.julialang.org/t/how-to-efficiently-construct-a-large-sparsearray-packages-for-this/64863 "2022-05-15T12:16:10Z")

</div>

Problem Does Julia have an efficient way of constructing a huge sparse matrix from a given list of entries u,v,w, some of which can have the same locations u,v, and in that case, their weights w must be summed. Thus u,v,…

---

## [Look for help for weird type inference](https://discourse.julialang.org/t/look-for-help-for-weird-type-inference/80834)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 2\
**Last updated:** [May 14, 2022, 11:21am UTC](https://discourse.julialang.org/t/look-for-help-for-weird-type-inference/80834 "2022-05-14T11:21:00Z")

</div>

Hi there, I am the author of ExtensibleEffects.jl and am trying to optimize the package. I debugged a type-inference instability but am totally puzzled about the behaviour. I cannot easily minify it, but can show it to …

---

## [Large matrix operations involving inversion](https://discourse.julialang.org/t/large-matrix-operations-involving-inversion/80993)

<div class="topic-metadata">

**Author:** [@Rajesh\_Nakka](https://discourse.julialang.org/u/Rajesh_Nakka)\
**Replies:** 5\
**Last updated:** [May 13, 2022, 5:57am UTC](https://discourse.julialang.org/t/large-matrix-operations-involving-inversion/80993 "2022-05-13T05:57:35Z")

</div>

In a particular problem, I have the following set of three evaluations involving matrices A, B, C of the SparseMatrixCSC type as B' \* A^{-} \* B B' \* A^{-} \* C C' \* A^{-} \* C Here, shape(A) = (n, n) shape(B) = (n, p…

---

## [A question about how arrays work, how memory is allocated and what happen when chunks of code inside a function are moved into another function](https://discourse.julialang.org/t/a-question-about-how-arrays-work-how-memory-is-allocated-and-what-happen-when-chunks-of-code-inside-a-function-are-moved-into-another-function/80971)

<div class="topic-metadata">

**Author:** [@Andrea\_Vigliotti](https://discourse.julialang.org/u/Andrea_Vigliotti)\
**Replies:** 10\
**Last updated:** [May 13, 2022, 3:30am UTC](https://discourse.julialang.org/t/a-question-about-how-arrays-work-how-memory-is-allocated-and-what-happen-when-chunks-of-code-inside-a-function-are-moved-into-another-function/80971 "2022-05-13T03:30:32Z")

</div>

I am trying to understand how to speed up some code when going multithreading and I posted a question about this a few days ago here. while trying things out I encountered some behavior that I can’t explain, here it goe…

---

## [Adding constant size vectors](https://discourse.julialang.org/t/adding-constant-size-vectors/80958)

<div class="topic-metadata">

**Author:** [@Fabrice\_Rosay](https://discourse.julialang.org/u/Fabrice_Rosay)\
**Replies:** 6\
**Last updated:** [May 12, 2022, 9:40pm UTC](https://discourse.julialang.org/t/adding-constant-size-vectors/80958 "2022-05-12T21:40:46Z")

</div>

I need to add two vectors of size 256. What would be the fastest way to do this? It needs to be as much optimized as possible as it will be inside an alpha-beta search. Sub questions would it be much faster if I use in…

---

## [Transducers/FLoops equivalent for mapreduce with dims arg (on GPU)](https://discourse.julialang.org/t/transducers-floops-equivalent-for-mapreduce-with-dims-arg-on-gpu/80767)

<div class="topic-metadata">

**Author:** [@Alex\_Ellison](https://discourse.julialang.org/u/Alex_Ellison)\
**Replies:** 9\
**Last updated:** [May 12, 2022, 7:41pm UTC](https://discourse.julialang.org/t/transducers-floops-equivalent-for-mapreduce-with-dims-arg-on-gpu/80767 "2022-05-12T19:41:30Z")

</div>

Hi all, Is it possible to write an equivalent of mapreduce(; dims) using either Transducers or FLoops? I’m interested in the NVidia GPU context. I want to do something like: julia\> begin using CUDA, LazyArrays …

---

## [A question about parallel performance in multithreading](https://discourse.julialang.org/t/a-question-about-parallel-performance-in-multithreading/80743)

<div class="topic-metadata">

**Author:** [@Andrea\_Vigliotti](https://discourse.julialang.org/u/Andrea_Vigliotti)\
**Replies:** 10\
**Last updated:** [May 12, 2022, 5:25pm UTC](https://discourse.julialang.org/t/a-question-about-parallel-performance-in-multithreading/80743 "2022-05-12T17:25:36Z")

</div>

Hi all, I am trying to understand why do I get such poor performances from multithreading. The context is a finite element program, I need to loop over all the elements of the model and evaluate the residual force vect…

---

## [Unexpected Allocations and performance loss from concrete classes](https://discourse.julialang.org/t/unexpected-allocations-and-performance-loss-from-concrete-classes/80754)

<div class="topic-metadata">

**Author:** [@djholiver](https://discourse.julialang.org/u/djholiver)\
**Replies:** 18\
**Last updated:** [May 11, 2022, 11:46am UTC](https://discourse.julialang.org/t/unexpected-allocations-and-performance-loss-from-concrete-classes/80754 "2022-05-11T11:46:15Z")

</div>

Hi, Apologies for what is probably “yet another” allocations post but I am unclear what I have done so wrong to experience the drop in performance I am experiencing. below is the original snippet that I then extend to M…

---

## [How to mark a function argument for specialization on types while still staying as a generic argument?](https://discourse.julialang.org/t/how-to-mark-a-function-argument-for-specialization-on-types-while-still-staying-as-a-generic-argument/80652)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 8\
**Last updated:** [May 10, 2022, 4:41pm UTC](https://discourse.julialang.org/t/how-to-mark-a-function-argument-for-specialization-on-types-while-still-staying-as-a-generic-argument/80652 "2022-05-10T16:41:01Z")

</div>

This is a follow up question which cristallized from this other discourse topic Problem I am struggeling with improving performance of my package ExtensibleEffects.jl because Julia is not specializing a function on type…

---

## [Faster Alternatives to sortperm](https://discourse.julialang.org/t/faster-alternatives-to-sortperm/80170)

<div class="topic-metadata">

**Author:** [@Josa9321](https://discourse.julialang.org/u/Josa9321)\
**Replies:** 9\
**Last updated:** [May 10, 2022, 4:33pm UTC](https://discourse.julialang.org/t/faster-alternatives-to-sortperm/80170 "2022-05-10T16:33:18Z")

</div>

Hi, I am manipulating an matrix (one or more lines) that has the priority numbers of another one, for example: priority = \[0.1 0.9 0.4 0.7 0.3\] # matrix filled using rand() A = \[col1 col2 col3 col4 col5\] # matrix fille…

---

## [Sum of logs](https://discourse.julialang.org/t/sum-of-logs/80370)

<div class="topic-metadata">

**Author:** [@cscherrer](https://discourse.julialang.org/u/cscherrer)\
**Replies:** 19\
**Last updated:** [May 10, 2022, 2:40pm UTC](https://discourse.julialang.org/t/sum-of-logs/80370 "2022-05-10T14:40:13Z")

</div>

In some statistical applications (and probably many others) we sometimes have to evaluate sum(log.(x)) for some large vector x. The obvious improvement to this is sum(log, x), but this still requires computing log for ea…

---

## [Need help on understanding type inference / performance](https://discourse.julialang.org/t/need-help-on-understanding-type-inference-performance/80600)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 13\
**Last updated:** [May 10, 2022, 9:54am UTC](https://discourse.julialang.org/t/need-help-on-understanding-type-inference-performance/80600 "2022-05-10T09:54:29Z")

</div>

Hi there, I am the author of ExtensibleEffects.jl and several people approached me that it would be great to improve performance (it is currently super slow). I made a first attempt on inspecting and found the followin…

---

## [How to speed up diagonalization of a Hamiltonian matrix?](https://discourse.julialang.org/t/how-to-speed-up-diagonalization-of-a-hamiltonian-matrix/80777)

<div class="topic-metadata">

**Author:** [@BastienD](https://discourse.julialang.org/u/BastienD)\
**Replies:** 0\
**Last updated:** [May 9, 2022, 7:51pm UTC](https://discourse.julialang.org/t/how-to-speed-up-diagonalization-of-a-hamiltonian-matrix/80777 "2022-05-09T19:51:50Z")

</div>

I would like to diagonalize the following Hamiltonian: \\mathcal{H} = \\begin{pmatrix} H & \\bar{\\Delta}\\\\ \\bar{\\Delta}^\\dagger & -H^\*\\\\ \\end{pmatrix} where H = \\begin{pmatrix} H\_s & H\_b\\\\ H\_b^T & H\_n\\\\ \\end{pmatrix} us…

---

## [Reading archives JLD2](https://discourse.julialang.org/t/reading-archives-jld2/80717)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 1\
**Last updated:** [May 9, 2022, 4:53pm UTC](https://discourse.julialang.org/t/reading-archives-jld2/80717 "2022-05-09T16:53:54Z")

</div>

Dear all, I have the matrix Xa\_heuristico\_1\_MP30.jld2 saved in a JLD2 format. When I run: Xa1\_heuristico\_MP30 = FileIO.load("Xa\_heuristico\_1\_MP30.jld2","RH") appears the folowing: How can I acess the element 1,…

---

## [I have a much faster version of evalpoly. Why is it faster?](https://discourse.julialang.org/t/i-have-a-much-faster-version-of-evalpoly-why-is-it-faster/79899)

<div class="topic-metadata">

**Author:** [@Luapulu](https://discourse.julialang.org/u/Luapulu)\
**Replies:** 14\
**Last updated:** [May 9, 2022, 3:36pm UTC](https://discourse.julialang.org/t/i-have-a-much-faster-version-of-evalpoly-why-is-it-faster/79899 "2022-05-09T15:36:16Z")

</div>

I was playing around with different ways to implement the evalpoly function. TLDR My best version is about twice as fast as the version currently in base and works with custom array indices. In this case while loops s…

---

## [Using a keyword argument leads to enormous allocations](https://discourse.julialang.org/t/using-a-keyword-argument-leads-to-enormous-allocations/80354)

<div class="topic-metadata">

**Author:** [@moble](https://discourse.julialang.org/u/moble)\
**Replies:** 8\
**Last updated:** [May 9, 2022, 3:09pm UTC](https://discourse.julialang.org/t/using-a-keyword-argument-leads-to-enormous-allocations/80354 "2022-05-09T15:09:00Z")

</div>

I’ve been running into a bizarre problem with huge allocations, and I’ve just discovered that the problem can be avoided if I don’t use a keyword argument to a function inside my main computation function. The allocatio…

---

## [Import a module only when needed](https://discourse.julialang.org/t/import-a-module-only-when-needed/80654)

<div class="topic-metadata">

**Author:** [@CarloLucibello](https://discourse.julialang.org/u/CarloLucibello)\
**Replies:** 5\
**Last updated:** [May 8, 2022, 11:34am UTC](https://discourse.julialang.org/t/import-a-module-only-when-needed/80654 "2022-05-08T11:34:04Z")

</div>

As a strategy for reducing using SomePkg latency, is it possible for a package to import a module in a lazy way, only when some functionality is required? Something similar to what Requires.jl, but where the user doesn’…

---

## [Installing Packages Julia v1.7.2](https://discourse.julialang.org/t/installing-packages-julia-v1-7-2/80678)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 1\
**Last updated:** [May 7, 2022, 8:06pm UTC](https://discourse.julialang.org/t/installing-packages-julia-v1-7-2/80678 "2022-05-07T20:06:21Z")

</div>

Dear all, I m a new user of Julia Language. I have installed Julia 1.7.2 and Atom. However, when I run Julia, the following credentials of Github are requested to install the initial packages: Updating git-repo \`ht…

---

## [Working with \`LinearAlgebra.mul!\`](https://discourse.julialang.org/t/working-with-linearalgebra-mul/80649)

<div class="topic-metadata">

**Author:** [@sinecera10](https://discourse.julialang.org/u/sinecera10)\
**Replies:** 12\
**Last updated:** [May 7, 2022, 11:42am UTC](https://discourse.julialang.org/t/working-with-linearalgebra-mul/80649 "2022-05-07T11:42:30Z")

</div>

Reposting a reddit post here to solicit comments from the Julia community. I may have chanced upon a bug? According to reddit users No-Distribution4263 and Foura5 both foo! and bar! should result in an error. But the cas…

---

## [Improve performance of Bellman operator](https://discourse.julialang.org/t/improve-performance-of-bellman-operator/80624)

<div class="topic-metadata">

**Author:** [@axel365](https://discourse.julialang.org/u/axel365)\
**Replies:** 7\
**Last updated:** [May 6, 2022, 8:05pm UTC](https://discourse.julialang.org/t/improve-performance-of-bellman-operator/80624 "2022-05-06T20:05:12Z")

</div>

Hi there, I am creating a function for the Bellman operator, a common tool in economics and macroeconomics. The function takes an Array of dimension n where n is the number of state variables and iterates it one period,…

---

## [Speed of power "^"](https://discourse.julialang.org/t/speed-of-power/80605)

<div class="topic-metadata">

**Author:** [@zhubonan](https://discourse.julialang.org/u/zhubonan)\
**Replies:** 16\
**Last updated:** [May 6, 2022, 3:17pm UTC](https://discourse.julialang.org/t/speed-of-power/80605 "2022-05-06T15:17:26Z")

</div>

I am writing a code that involves lots of use of “^” and profiling seems to suggest “^” is contributing a lot of the time. I have done the following test of the timing. Replacing “^” “\*” seems to give a massive speed up…

---

## [Optimizing a Spectral Proper Orthogonal Decomposition Method](https://discourse.julialang.org/t/optimizing-a-spectral-proper-orthogonal-decomposition-method/80522)

<div class="topic-metadata">

**Author:** [@Whyborn](https://discourse.julialang.org/u/Whyborn)\
**Replies:** 19\
**Last updated:** [May 6, 2022, 11:24am UTC](https://discourse.julialang.org/t/optimizing-a-spectral-proper-orthogonal-decomposition-method/80522 "2022-05-06T11:24:45Z")

</div>

I have written a Spectral Proper Orthogonal Decomposition (doi:10.1017/jfm.2018.283) algorithm in both Python and Julia, and I’ve found my Python code to be about 5x faster than the Julia code. I expect the performance t…

---

## [Which variable initialization is optimized away when variable unused?](https://discourse.julialang.org/t/which-variable-initialization-is-optimized-away-when-variable-unused/80587)

<div class="topic-metadata">

**Author:** [@FireCrumb](https://discourse.julialang.org/u/FireCrumb)\
**Replies:** 2\
**Last updated:** [May 6, 2022, 5:39am UTC](https://discourse.julialang.org/t/which-variable-initialization-is-optimized-away-when-variable-unused/80587 "2022-05-06T05:39:24Z")

</div>

I have a method where x is used, but y isn’t used. Why when I assign sqrt(100) to y then it’s ignored and not even executed (which is the desired behaviour), but when it’s assigned collect(1:100) then it is executed? I…

---

## [Makie recipe with plots being added on the fly and why does the recipe run so long](https://discourse.julialang.org/t/makie-recipe-with-plots-being-added-on-the-fly-and-why-does-the-recipe-run-so-long/80539)

<div class="topic-metadata">

**Author:** [@kunzaatko](https://discourse.julialang.org/u/kunzaatko)\
**Replies:** 3\
**Last updated:** [May 5, 2022, 9:17pm UTC](https://discourse.julialang.org/t/makie-recipe-with-plots-being-added-on-the-fly-and-why-does-the-recipe-run-so-long/80539 "2022-05-05T21:17:10Z")

</div>

I am trying to make a Makie recipe for a sequence of images with the current image frame from the sequence being an Observable (frame). I would like to have the separate frames of the image load on demand, when the frame …

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

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