# Performance

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

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

**Page:** 96

---

## [Fast computation of row-wise Kronecker product (Khatri-Rao product)](https://discourse.julialang.org/t/fast-computation-of-row-wise-kronecker-product-khatri-rao-product/58762)

<div class="topic-metadata">

**Author:** [@Germinator](https://discourse.julialang.org/u/Germinator)\
**Replies:** 5\
**Last updated:** [April 8, 2021, 7:31am UTC](https://discourse.julialang.org/t/fast-computation-of-row-wise-kronecker-product-khatri-rao-product/58762 "2021-04-08T07:31:24Z")

</div>

Hello! I have recently started to migrate to Julia, and decided to port some of my Matlab code. I am struggling to make a performant row-wise Kronecker product (Khatri-Rao product) implementation for two or three matrice…

---

## [Julia 1.6.0 packages installation](https://discourse.julialang.org/t/julia-1-6-0-packages-installation/58552)

<div class="topic-metadata">

**Author:** [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Replies:** 10\
**Last updated:** [April 8, 2021, 5:49am UTC](https://discourse.julialang.org/t/julia-1-6-0-packages-installation/58552 "2021-04-08T05:49:30Z")

</div>

How to solve this problem: Some packages have a happy installation and others do not! (@v1.6) pkg\> add Plots Updating registry at \`C:\\Users\\hermesr\\.julia\\registries\\General\` ┌ Warning: could not download https://p…

---

## [For-loop vs list-comprehension](https://discourse.julialang.org/t/for-loop-vs-list-comprehension/58702)

<div class="topic-metadata">

**Author:** [@pedrobtz](https://discourse.julialang.org/u/pedrobtz)\
**Replies:** 15\
**Last updated:** [April 7, 2021, 10:56am UTC](https://discourse.julialang.org/t/for-loop-vs-list-comprehension/58702 "2021-04-07T10:56:12Z")

</div>

Why isn’t the list-comprehension as fast as the for-loop? using Random using BenchmarkTools y = zeros(UInt8,256); y\[UInt8('A')\] = UInt8('U'); y\[UInt8('C')\] = UInt8('G'); y\[UInt8('G')\] = UInt8('C'); y\[UInt8('T')\] = UInt…

---

## [Optimizing remainder with constant modulus implementation](https://discourse.julialang.org/t/optimizing-remainder-with-constant-modulus-implementation/58586)

<div class="topic-metadata">

**Author:** [@pjentsch0](https://discourse.julialang.org/u/pjentsch0)\
**Replies:** 2\
**Last updated:** [April 6, 2021, 2:10pm UTC](https://discourse.julialang.org/t/optimizing-remainder-with-constant-modulus-implementation/58586 "2021-04-06T14:10:53Z")

</div>

Hi performance people! I am implementing the remainder routines for constant modulus from this paper by Lemire et al. in Julia from their C examples. Below is the original C implementation followed by my julia translati…

---

## [Faster way to "save" and "load" structs](https://discourse.julialang.org/t/faster-way-to-save-and-load-structs/58704)

<div class="topic-metadata">

**Author:** [@RXGottlieb](https://discourse.julialang.org/u/RXGottlieb)\
**Replies:** 4\
**Last updated:** [April 6, 2021, 6:43pm UTC](https://discourse.julialang.org/t/faster-way-to-save-and-load-structs/58704 "2021-04-06T18:43:46Z")

</div>

I’m working on a project in which I need to repeatedly remember the status of my process, make a small change, and then re-load the original status from before the change was made. Think something like a Monte Carlo tree…

---

## [Computing L1 norm between vectors: julian way](https://discourse.julialang.org/t/computing-l1-norm-between-vectors-julian-way/58680)

<div class="topic-metadata">

**Author:** [@ismedina](https://discourse.julialang.org/u/ismedina)\
**Replies:** 14\
**Last updated:** [April 6, 2021, 6:34pm UTC](https://discourse.julialang.org/t/computing-l1-norm-between-vectors-julian-way/58680 "2021-04-06T18:34:43Z")

</div>

I need to code a function that computes the L1 distance between the two vectors. It doesn’t need to be super precise — it serves as the estimate for some error as part of the stopping criterion of an algorithm—, but it n…

---

## [The most general way to estimate the optimal arguments for @cuda macro](https://discourse.julialang.org/t/the-most-general-way-to-estimate-the-optimal-arguments-for-cuda-macro/39342)

<div class="topic-metadata">

**Author:** [@fedoroff](https://discourse.julialang.org/u/fedoroff)\
**Replies:** 6\
**Last updated:** [April 6, 2021, 2:12pm UTC](https://discourse.julialang.org/t/the-most-general-way-to-estimate-the-optimal-arguments-for-cuda-macro/39342 "2021-04-06T14:12:17Z")

</div>

How one can choose the optimal arguments (threads, blocks, etc.) to launch CUDA kernels using @cuda macro? In the following example I consider a simple kernel which does vector addition of two matrices: using CuArrays u…

---

## [Fast computation of Grammian of matrix](https://discourse.julialang.org/t/fast-computation-of-grammian-of-matrix/56244)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 11\
**Last updated:** [April 6, 2021, 1:16pm UTC](https://discourse.julialang.org/t/fast-computation-of-grammian-of-matrix/56244 "2021-04-06T13:16:09Z")

</div>

For some model indentification problems, I have to compute the grammian of data matrices i.e. compute A = X'\*X where X is a complex rectangular matrix. Is there a fast implementation of this specific operation in julia …

---

## [Accelerate Non-linear function evaluation](https://discourse.julialang.org/t/accelerate-non-linear-function-evaluation/42105)

<div class="topic-metadata">

**Author:** [@bdc](https://discourse.julialang.org/u/bdc)\
**Replies:** 17\
**Last updated:** [April 6, 2021, 12:48pm UTC](https://discourse.julialang.org/t/accelerate-non-linear-function-evaluation/42105 "2021-04-06T12:48:33Z")

</div>

Hi, I’m working on an application with maximum entropy networks. To determine some parameters, a system of non-linear equation F(x)=0 needs to be solved. For a network of n nodes, each node i has an associated equation…

---

## [Economy-sized QR decomposition](https://discourse.julialang.org/t/economy-sized-qr-decomposition/57608)

<div class="topic-metadata">

**Author:** [@qrebjock](https://discourse.julialang.org/u/qrebjock)\
**Replies:** 10\
**Last updated:** [April 6, 2021, 6:34am UTC](https://discourse.julialang.org/t/economy-sized-qr-decomposition/57608 "2021-04-06T06:34:59Z")

</div>

Hello, It seems like the function qr doesn’t take keywords argument to return an economy-sized factorization. In this thread qr(A; full=false) no longer available? · Issue #27397 · JuliaLang/julia · GitHub they say tha…

---

## [Fast 4D argmax](https://discourse.julialang.org/t/fast-4d-argmax/58566)

<div class="topic-metadata">

**Author:** [@jroon](https://discourse.julialang.org/u/jroon)\
**Replies:** 26\
**Last updated:** [April 6, 2021, 1:06am UTC](https://discourse.julialang.org/t/fast-4d-argmax/58566 "2021-04-06T01:06:04Z")

</div>

Hi Julia-folks! I’m new to Julia (very new), but work mainly in R. I’m trying to replace a slow bit of R code with a Julia function that I will call from within R. Essentially what I’m trying to achieve is argmax of a 4…

---

## [Julia slows down after computer upgrade](https://discourse.julialang.org/t/julia-slows-down-after-computer-upgrade/58503)

<div class="topic-metadata">

**Author:** [@mengxiaoliu](https://discourse.julialang.org/u/mengxiaoliu)\
**Replies:** 15\
**Last updated:** [April 6, 2021, 12:46am UTC](https://discourse.julialang.org/t/julia-slows-down-after-computer-upgrade/58503 "2021-04-06T00:46:19Z")

</div>

Hi. I am very new to Julia and am not a computer geek so this question may not be very clear. I am happy to add any information as necessary. I am running Julia on VSCode in Windows. I recently added some memory sticks …

---

## [How to avoid boxed function names in closures?](https://discourse.julialang.org/t/how-to-avoid-boxed-function-names-in-closures/58579)

<div class="topic-metadata">

**Author:** [@matthias314](https://discourse.julialang.org/u/matthias314)\
**Replies:** 6\
**Last updated:** [April 5, 2021, 8:29pm UTC](https://discourse.julialang.org/t/how-to-avoid-boxed-function-names-in-closures/58579 "2021-04-05T20:29:18Z")

</div>

Hello! In order to avoid performance problems, I would like to know whether boxes can be avoided in two kinds of closures. Without closures, all problems mentioned below disappear. I’m using Julia 1.6.0. Keyword argumen…

---

## [CAS benchmarks (Symbolics.jl and Maxima)](https://discourse.julialang.org/t/cas-benchmarks-symbolics-jl-and-maxima/58359)

<div class="topic-metadata">

**Author:** [@rfateman](https://discourse.julialang.org/u/rfateman)\
**Replies:** 36\
**Last updated:** [April 5, 2021, 8:06pm UTC](https://discourse.julialang.org/t/cas-benchmarks-symbolics-jl-and-maxima/58359 "2021-04-05T20:06:29Z")

</div>

I still don’t understand why you are touting the speed of Julia symbolic code (compiled) compared to the speed of SymPy (interpreted). I looked for a benchmark that could be run in (say) Maxima, but finally came up a r…

---

## [Trivial question about workers on a cluster](https://discourse.julialang.org/t/trivial-question-about-workers-on-a-cluster/58517)

<div class="topic-metadata">

**Author:** [@Frisus95](https://discourse.julialang.org/u/Frisus95)\
**Replies:** 1\
**Last updated:** [April 3, 2021, 10:40pm UTC](https://discourse.julialang.org/t/trivial-question-about-workers-on-a-cluster/58517 "2021-04-03T22:40:21Z")

</div>

Good day everyone! As the title suggests, I have a (probably trivial) question about how to run a parallel computation on multiple nodes in a cluster. My code calls an external library, written in C, and then paralleli…

---

## [How to implement embeddings in Flux that aren't tragically slow?](https://discourse.julialang.org/t/how-to-implement-embeddings-in-flux-that-arent-tragically-slow/55201)

<div class="topic-metadata">

**Author:** [@jjminton](https://discourse.julialang.org/u/jjminton)\
**Replies:** 3\
**Last updated:** [April 3, 2021, 8:56am UTC](https://discourse.julialang.org/t/how-to-implement-embeddings-in-flux-that-arent-tragically-slow/55201 "2021-04-03T08:56:43Z")

</div>

I have recently started learning Julia and Flux for machine learning. I am trying to implement word2vec as a starting point, but the gradient calculations slow down dramatically with larger vocabulary sizes. With negativ…

---

## [Question about floating-point precision in summation](https://discourse.julialang.org/t/question-about-floating-point-precision-in-summation/58334)

<div class="topic-metadata">

**Author:** [@Frisus95](https://discourse.julialang.org/u/Frisus95)\
**Replies:** 22\
**Last updated:** [April 2, 2021, 9:00pm UTC](https://discourse.julialang.org/t/question-about-floating-point-precision-in-summation/58334 "2021-04-02T21:00:13Z")

</div>

Hello everyone, I have a “technical” (probably trivial) question. My code computes a lot of matrices (calling an external library in C) by parallelizing on multiple processes, then finally adds these matrices and we get…

---

## [Threads.@threads with ONE thread: how to remove the overhead?](https://discourse.julialang.org/t/threads-threads-with-one-thread-how-to-remove-the-overhead/58435)

<div class="topic-metadata">

**Author:** [@Shuhua](https://discourse.julialang.org/u/Shuhua)\
**Replies:** 10\
**Last updated:** [April 2, 2021, 7:00pm UTC](https://discourse.julialang.org/t/threads-threads-with-one-thread-how-to-remove-the-overhead/58435 "2021-04-02T19:00:17Z")

</div>

If there is only one thread set, the overhead of Threads.@threads is significant. julia\> Threads.nthreads() 1 julia\> function single\_thread(v) s = 0.0 @inbounds for i = 1:length(v) …

---

## [Restructuring Performant Code (C, Pascal) with Type Unions and Pointers](https://discourse.julialang.org/t/restructuring-performant-code-c-pascal-with-type-unions-and-pointers/58374)

<div class="topic-metadata">

**Author:** [@tawheeler](https://discourse.julialang.org/u/tawheeler)\
**Replies:** 11\
**Last updated:** [April 2, 2021, 5:39pm UTC](https://discourse.julialang.org/t/restructuring-performant-code-c-pascal-with-type-unions-and-pointers/58374 "2021-04-02T17:39:13Z")

</div>

Hello! I’ve been taking a stab at porting the YASS sokoban solver into Julia as a programming exercise. It is a 20k line Pascal program that can solve some pretty hard sokoban problems (block pushing) in under a second. …

---

## [LoopVectorization.jl's @avx does not store results](https://discourse.julialang.org/t/loopvectorization-jls-avx-does-not-store-results/58373)

<div class="topic-metadata">

**Author:** [@ambiso](https://discourse.julialang.org/u/ambiso)\
**Replies:** 9\
**Last updated:** [April 2, 2021, 4:14pm UTC](https://discourse.julialang.org/t/loopvectorization-jls-avx-does-not-store-results/58373 "2021-04-02T16:14:02Z")

</div>

Hi, I was trying to write a SIMD version of a to\_upper function using LoopVectorization.jl package. Here’s the branchless version: function to\_upper\_branchless(s) b = Vector{UInt8}(s) for i ∈ eachindex(b) …

---

## [Ref() which doesn't escape inside a function allocates on the heap](https://discourse.julialang.org/t/ref-which-doesnt-escape-inside-a-function-allocates-on-the-heap/58406)

<div class="topic-metadata">

**Author:** [@balenamiaa](https://discourse.julialang.org/u/balenamiaa)\
**Replies:** 1\
**Last updated:** [April 2, 2021, 1:55am UTC](https://discourse.julialang.org/t/ref-which-doesnt-escape-inside-a-function-allocates-on-the-heap/58406 "2021-04-02T01:55:45Z")

</div>

I recently learnt that creating a Ref inside a function in which it doesn’t escape will lead to a stack allocation instead of heap-allocation. But then when writing a cuda kernel like so - function \_kernel\_0(trail, part…

---

## [Does this lose the benefit of QR decomposition?](https://discourse.julialang.org/t/does-this-lose-the-benefit-of-qr-decomposition/58324)

<div class="topic-metadata">

**Author:** [@Ross\_Boylan](https://discourse.julialang.org/u/Ross_Boylan)\
**Replies:** 2\
**Last updated:** [April 1, 2021, 11:49pm UTC](https://discourse.julialang.org/t/does-this-lose-the-benefit-of-qr-decomposition/58324 "2021-04-01T23:49:29Z")

</div>

My understanding is that one can do fast multiplies by the Q matrix of the QR decomposition because it is represented as a sequence of Householder reflections. I want to compute deltai = 3:size(T, 1) δ = Q\[:, d…

---

## [Drop of performances with Julia 1.6.0 for InterpolationKernels](https://discourse.julialang.org/t/drop-of-performances-with-julia-1-6-0-for-interpolationkernels/58085)

<div class="topic-metadata">

**Author:** [@emmt](https://discourse.julialang.org/u/emmt)\
**Replies:** 40\
**Last updated:** [April 1, 2021, 8:21pm UTC](https://discourse.julialang.org/t/drop-of-performances-with-julia-1-6-0-for-interpolationkernels/58085 "2021-04-01T20:21:32Z")

</div>

I was happy to switch from Julia 1.5.4 to Julia 1.6.0 but I experienced significant drops of performances for InterpolationKernels by up to a factor 3.6… Below are tables summarizing my tests with BenchmarkTools. The c…

---

## [Recompiling functions with infrequently mutating constant](https://discourse.julialang.org/t/recompiling-functions-with-infrequently-mutating-constant/58368)

<div class="topic-metadata">

**Author:** [@Deduction42](https://discourse.julialang.org/u/Deduction42)\
**Replies:** 7\
**Last updated:** [April 1, 2021, 4:54pm UTC](https://discourse.julialang.org/t/recompiling-functions-with-infrequently-mutating-constant/58368 "2021-04-01T16:54:39Z")

</div>

I’m writing an application with a whole bunch of vectors of length N that syntactically have elements having a consistent meaning (chemical components in a mixture). Most of the time, I don’t need the names, but on some …

---

## [Tuple indexing taking time?](https://discourse.julialang.org/t/tuple-indexing-taking-time/58309)

<div class="topic-metadata">

**Author:** [@markmbaum](https://discourse.julialang.org/u/markmbaum)\
**Replies:** 25\
**Last updated:** [April 1, 2021, 2:51pm UTC](https://discourse.julialang.org/t/tuple-indexing-taking-time/58309 "2021-04-01T14:51:00Z")

</div>

A fairly general question about a function that I’m working on before I try to summarize what it’s doing. The profile view is below. There are three main red blocks that take up most of the time, each for the same line o…

---

## [Radial Basis Surrogate](https://discourse.julialang.org/t/radial-basis-surrogate/58192)

<div class="topic-metadata">

**Author:** [@Manisha\_07](https://discourse.julialang.org/u/Manisha_07)\
**Replies:** 6\
**Last updated:** [April 1, 2021, 1:43pm UTC](https://discourse.julialang.org/t/radial-basis-surrogate/58192 "2021-04-01T13:43:16Z")

</div>

I am trying to execute the following program but facing the issue. Please help me to resolve this

---

## [New scientific computing benchmark - Network of differential equations](https://discourse.julialang.org/t/new-scientific-computing-benchmark-network-of-differential-equations/58221)

<div class="topic-metadata">

**Author:** [@lindnemi](https://discourse.julialang.org/u/lindnemi)\
**Replies:** 8\
**Last updated:** [March 31, 2021, 3:39pm UTC](https://discourse.julialang.org/t/new-scientific-computing-benchmark-network-of-differential-equations/58221 "2021-03-31T15:39:21Z")

</div>

For our recent paper on NetworkDynamics.jl, we developed a benchmark problem. The goal is to solve a Kuramoto system on a sparse random graph, i.e. \\dot \\theta\_i = \\omega\_i + \\sigma \\sum\_{j=1}^N sin(\\theta\_j - \\theta\_i…

---

## [Performance of computing the diagonal of V' \* A \*V](https://discourse.julialang.org/t/performance-of-computing-the-diagonal-of-v-a-v/58288)

<div class="topic-metadata">

**Author:** [@migarstka](https://discourse.julialang.org/u/migarstka)\
**Replies:** 10\
**Last updated:** [March 31, 2021, 1:22pm UTC](https://discourse.julialang.org/t/performance-of-computing-the-diagonal-of-v-a-v/58288 "2021-03-31T13:22:55Z")

</div>

I want to compute the diagonal elements of X = V^\\top A V where V is an orthogonal matrix A is a symmetric matrix I noticed that it is much faster to just compute X and then extract the diagonal elements than compu…

---

## [Implementing option to profile a script as environment variable or command line argument](https://discourse.julialang.org/t/implementing-option-to-profile-a-script-as-environment-variable-or-command-line-argument/58189)

<div class="topic-metadata">

**Author:** [@luke](https://discourse.julialang.org/u/luke)\
**Replies:** 4\
**Last updated:** [March 31, 2021, 12:20am UTC](https://discourse.julialang.org/t/implementing-option-to-profile-a-script-as-environment-variable-or-command-line-argument/58189 "2021-03-31T00:20:12Z")

</div>

This is a bit of a stylistic “what’s the most elegant way to do this?” question than a functionality question. Basically, let’s say we have a script that runs some computation and saves some outputs for us, and we’re cur…

---

## [CUDA.jl tutorial code kernel slower than broadcast](https://discourse.julialang.org/t/cuda-jl-tutorial-code-kernel-slower-than-broadcast/58242)

<div class="topic-metadata">

**Author:** [@Satvik](https://discourse.julialang.org/u/Satvik)\
**Replies:** 4\
**Last updated:** [March 30, 2021, 4:05pm UTC](https://discourse.julialang.org/t/cuda-jl-tutorial-code-kernel-slower-than-broadcast/58242 "2021-03-30T16:05:06Z")

</div>

Hi, The CUDA.jl tutorial has broadcasted addition, and then a series of steps to write a kernel that’s supposed to be about as fast. But on my machine, the kernel is about 10x slower, and I’d like to understand why. He…

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

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