# Performance

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

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

**Page:** 93

---

## [Error while trying to download the Distributions Package on JuliaPro](https://discourse.julialang.org/t/error-while-trying-to-download-the-distributions-package-on-juliapro/60812)

<div class="topic-metadata">

**Author:** [@Diana\_Paola](https://discourse.julialang.org/u/Diana_Paola)\
**Replies:** 9\
**Last updated:** [May 14, 2021, 3:55am UTC](https://discourse.julialang.org/t/error-while-trying-to-download-the-distributions-package-on-juliapro/60812 "2021-05-14T03:55:24Z")

</div>

Hi, I’m pretty new in Julia and I’m trying to download the Distributions Package on JuliaPro 1.5.0-1 and it seems to be an error but I don’t know why :confused: . If anyone can help me because I really need it and I don’…

---

## [Improving performance of Integral equations (3-Nested loops)](https://discourse.julialang.org/t/improving-performance-of-integral-equations-3-nested-loops/61072)

<div class="topic-metadata">

**Author:** [@Debasish](https://discourse.julialang.org/u/Debasish)\
**Replies:** 4\
**Last updated:** [May 13, 2021, 3:07pm UTC](https://discourse.julialang.org/t/improving-performance-of-integral-equations-3-nested-loops/61072 "2021-05-13T15:07:51Z")

</div>

Dear Julia experts, This is my first ever code in Julia. Why I am switching to Julia? I have used Fortran and Matlab before to write boundary element codes previously. Here is an example https://www.youtube.com/watc…

---

## [Correct preallocation for different Autodiff libraries](https://discourse.julialang.org/t/correct-preallocation-for-different-autodiff-libraries/60707)

<div class="topic-metadata">

**Author:** [@triceert](https://discourse.julialang.org/u/triceert)\
**Replies:** 3\
**Last updated:** [May 13, 2021, 12:07pm UTC](https://discourse.julialang.org/t/correct-preallocation-for-different-autodiff-libraries/60707 "2021-05-13T12:07:59Z")

</div>

I have some quite complex Julia package which I would like to tweak for performance. As I understand, the key for this will be to make the code type-stable and reusing memory, especially for repeatedly called expensive f…

---

## [Parse a large array of small JSON objects?](https://discourse.julialang.org/t/parse-a-large-array-of-small-json-objects/61040)

<div class="topic-metadata">

**Author:** [@Satvik](https://discourse.julialang.org/u/Satvik)\
**Replies:** 2\
**Last updated:** [May 12, 2021, 8:36pm UTC](https://discourse.julialang.org/t/parse-a-large-array-of-small-json-objects/61040 "2021-05-12T20:36:29Z")

</div>

Hi, I have a DataFrame that contains a column of several million JSON strings, e.g. julia\> DataFrame(j=""""{a": 1, "b": 2}""") julia\> pretty\_table(df) ┌──────────────────┐ │ j │ │ String │ ├───…

---

## [Proper way to access large matrix in a matrix list](https://discourse.julialang.org/t/proper-way-to-access-large-matrix-in-a-matrix-list/60965)

<div class="topic-metadata">

**Author:** [@ZhiyuanYao](https://discourse.julialang.org/u/ZhiyuanYao)\
**Replies:** 12\
**Last updated:** [May 12, 2021, 11:42am UTC](https://discourse.julialang.org/t/proper-way-to-access-large-matrix-in-a-matrix-list/60965 "2021-05-12T11:42:37Z")

</div>

I have the following code snippet where eigvecs\_k is a global variable, of type Vector{Matrix{ComplexF64}} and consists two matrix of size 4300\*4300. basisN = 4300 function constructPsi!(coeffs\_k::Vector{Vector{ComplexF…

---

## [Thread-parallel reduce(vcat, ...) performance issues when providing init](https://discourse.julialang.org/t/thread-parallel-reduce-vcat-performance-issues-when-providing-init/60955)

<div class="topic-metadata">

**Author:** [@cgeoga](https://discourse.julialang.org/u/cgeoga)\
**Replies:** 2\
**Last updated:** [May 11, 2021, 7:15pm UTC](https://discourse.julialang.org/t/thread-parallel-reduce-vcat-performance-issues-when-providing-init/60955 "2021-05-11T19:15:11Z")

</div>

Hey all— I’ve got a problem where I have a vec\_of\_vecs::Vector{Vector{T}} where the length is long and the length of each element is long. I’d love to use multithreading to do reduce(vcat, vec\_of\_vecs) more efficiently.…

---

## [Memory allocations and performance with multithreading](https://discourse.julialang.org/t/memory-allocations-and-performance-with-multithreading/60831)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 8\
**Last updated:** [May 10, 2021, 2:30pm UTC](https://discourse.julialang.org/t/memory-allocations-and-performance-with-multithreading/60831 "2021-05-10T14:30:19Z")

</div>

I’m trying to take use of mulithreading to parallelize an internal loop, but while it works (correct answer and I can see CPU being used), there is a serious performance hit: function update(x, Δt) return x + 0.5 \* …

---

## [Allocations with closure and mul!](https://discourse.julialang.org/t/allocations-with-closure-and-mul/60744)

<div class="topic-metadata">

**Author:** [@geoffroyleconte](https://discourse.julialang.org/u/geoffroyleconte)\
**Replies:** 4\
**Last updated:** [May 10, 2021, 2:19pm UTC](https://discourse.julialang.org/t/allocations-with-closure-and-mul/60744 "2021-05-10T14:19:44Z")

</div>

Hi! I have an issue with allocations using the mul! function and a closure: using LinearAlgebra, Test struct operator{T} prod! end function operator(A :: AbstractArray{T}) where T prod! = (res, u, α, β) -\> m…

---

## [Possible slow fallback of adjoint matrix multiplication for different element types](https://discourse.julialang.org/t/possible-slow-fallback-of-adjoint-matrix-multiplication-for-different-element-types/60853)

<div class="topic-metadata">

**Author:** [@songxianxu](https://discourse.julialang.org/u/songxianxu)\
**Replies:** 0\
**Last updated:** [May 10, 2021, 6:16am UTC](https://discourse.julialang.org/t/possible-slow-fallback-of-adjoint-matrix-multiplication-for-different-element-types/60853 "2021-05-10T06:16:31Z")

</div>

I was running some matrix diagonalization and processing the eigenvectors. I notice that the script takes an unusually long time and I realize that it could be a problem of the adjoint matrix multiplication. Here is the…

---

## [Multithreading and generated code](https://discourse.julialang.org/t/multithreading-and-generated-code/60828)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 5\
**Last updated:** [May 9, 2021, 5:42pm UTC](https://discourse.julialang.org/t/multithreading-and-generated-code/60828 "2021-05-09T17:42:50Z")

</div>

A while back, I solved this problem, Performance and Allocation with Arrays of Functions. More recently, I wanted a multithreaded loop inside of this, so that the code now reads: function update(x, Δt) return x + 0…

---

## [Named Pipes between Julia and CSharp](https://discourse.julialang.org/t/named-pipes-between-julia-and-csharp/45845)

<div class="topic-metadata">

**Author:** [@Impressium](https://discourse.julialang.org/u/Impressium)\
**Replies:** 5\
**Last updated:** [May 9, 2021, 2:51pm UTC](https://discourse.julialang.org/t/named-pipes-between-julia-and-csharp/45845 "2021-05-09T14:51:59Z")

</div>

Hi dear community :slight\_smile: I’m trying to communicate between Julia and CSharp with named pipes on Windows. I’m using following code in Csharp server: using (var pipe = new NamedPipeServerStream("cs", PipeDirecti…

---

## [Function with parameter: \`f(x,p)\` or \`f(x;p)\`](https://discourse.julialang.org/t/function-with-parameter-f-x-p-or-f-x-p/60745)

<div class="topic-metadata">

**Author:** [@misha\_mikhasenko](https://discourse.julialang.org/u/misha_mikhasenko)\
**Replies:** 9\
**Last updated:** [May 9, 2021, 7:43am UTC](https://discourse.julialang.org/t/function-with-parameter-f-x-p-or-f-x-p/60745 "2021-05-09T07:43:39Z")

</div>

I have been using the call with the key argument to provide parameters f(x;p=(a=1.1,b=2.2)) taking advantage of broadcasting without Ref. However, noticed f(x,p) is a common format as well. Any thoughts on which way is …

---

## [@code\_warntype shows lots of Union{Nothing, Tuple{Int64, Int64}}](https://discourse.julialang.org/t/code-warntype-shows-lots-of-union-nothing-tuple-int64-int64/60748)

<div class="topic-metadata">

**Author:** [@rpmuller](https://discourse.julialang.org/u/rpmuller)\
**Replies:** 7\
**Last updated:** [May 8, 2021, 12:41am UTC](https://discourse.julialang.org/t/code-warntype-shows-lots-of-union-nothing-tuple-int64-int64/60748 "2021-05-08T00:41:35Z")

</div>

I’m working through @ChrisRackauckas excellent article 7 Julia Gotchas and How to Handle Them - Stochastic Lifestyle. One of his big recommendations is to use @code\_warntype. I already found an untyped container that ma…

---

## [Manual reduction much faster than atomic\_add with @threads](https://discourse.julialang.org/t/manual-reduction-much-faster-than-atomic-add-with-threads/60721)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 7\
**Last updated:** [May 7, 2021, 11:30pm UTC](https://discourse.julialang.org/t/manual-reduction-much-faster-than-atomic-add-with-threads/60721 "2021-05-07T23:30:20Z")

</div>

In these examples, manually splitting and reducing the sum provides a good scaling, while using the Atomic operations is prohibitive: using Base.Threads, BenchmarkTools, Test function f\_manual() total\_Sum = zeros(n…

---

## [Specifying which lines I want to be fast](https://discourse.julialang.org/t/specifying-which-lines-i-want-to-be-fast/60699)

<div class="topic-metadata">

**Author:** [@jzr](https://discourse.julialang.org/u/jzr)\
**Replies:** 4\
**Last updated:** [May 7, 2021, 6:55pm UTC](https://discourse.julialang.org/t/specifying-which-lines-i-want-to-be-fast/60699 "2021-05-07T18:55:26Z")

</div>

I want most of my code to be interpreter-slow in order to avoid compiler latency, but one or two lines need to be compiled-fast. Is it possible to get both of those in the same session?

---

## [Uniform scaling inplace addition with matrix](https://discourse.julialang.org/t/uniform-scaling-inplace-addition-with-matrix/59928)

<div class="topic-metadata">

**Author:** [@jarl](https://discourse.julialang.org/u/jarl)\
**Replies:** 13\
**Last updated:** [May 7, 2021, 1:01pm UTC](https://discourse.julialang.org/t/uniform-scaling-inplace-addition-with-matrix/59928 "2021-05-07T13:01:41Z")

</div>

I want to do an inplace add of a multiple of the identity to a matrix. I can get the efficiency I want with a view of the diagonal: using LinearAlgebra function f1!(A,s) D = view(A, diagind(A, 0)) D .+= s; end ju…

---

## [real-time camera acquisition and processing, howto](https://discourse.julialang.org/t/real-time-camera-acquisition-and-processing-howto/20398)

<div class="topic-metadata">

**Author:** [@Stefan\_Karlsson](https://discourse.julialang.org/u/Stefan_Karlsson)\
**Replies:** 16\
**Last updated:** [May 7, 2021, 12:40pm UTC](https://discourse.julialang.org/t/real-time-camera-acquisition-and-processing-howto/20398 "2021-05-07T12:40:13Z")

</div>

This is the same issue that is covered by my stackoverflow post. I have searched to best of my ability online, especially this discourse and stackoverflow. I am new to Julia. I want to use the REPL to learn, and then de…

---

## [Change a function without the actual evaluation ...?](https://discourse.julialang.org/t/change-a-function-without-the-actual-evaluation/60657)

<div class="topic-metadata">

**Author:** [@iHany](https://discourse.julialang.org/u/iHany)\
**Replies:** 1\
**Last updated:** [May 7, 2021, 7:32am UTC](https://discourse.julialang.org/t/change-a-function-without-the-actual-evaluation/60657 "2021-05-07T07:32:37Z")

</div>

Hi. I’d like to know if there is a way to convert a function to a different form without the actual evaluation. For example, I’m trying to make an API of DifferentialEquations.jl. However, I encountered a serious perfo…

---

## [Best approach to smooth array? None of my approaches are very useful](https://discourse.julialang.org/t/best-approach-to-smooth-array-none-of-my-approaches-are-very-useful/17633)

<div class="topic-metadata">

**Author:** [@aramirezreyes](https://discourse.julialang.org/u/aramirezreyes)\
**Replies:** 18\
**Last updated:** [May 6, 2021, 10:23pm UTC](https://discourse.julialang.org/t/best-approach-to-smooth-array-none-of-my-approaches-are-very-useful/17633 "2021-05-06T22:23:23Z")

</div>

Hi! I´ve been trying this week to get something accomplished but I cannot get it done. Problem: I have group of variables coming from a NetCDF. When imported using NCDatasets, I get arrays of 64 bits with a size (128,1…

---

## [Why using \`+=\` instead of \`=\` generates slow code?](https://discourse.julialang.org/t/why-using-instead-of-generates-slow-code/60664)

<div class="topic-metadata">

**Author:** [@1115](https://discourse.julialang.org/u/1115)\
**Replies:** 5\
**Last updated:** [May 6, 2021, 5:02pm UTC](https://discourse.julialang.org/t/why-using-instead-of-generates-slow-code/60664 "2021-05-06T17:02:38Z")

</div>

I have two functions, their only difference is one uses += and another uses =, but are making a \> 4x performance difference. The + is much faster than sin and cos and I suppose the following two functions should not make…

---

## [Code runtime constantly increasing with time](https://discourse.julialang.org/t/code-runtime-constantly-increasing-with-time/60437)

<div class="topic-metadata">

**Author:** [@ff1991](https://discourse.julialang.org/u/ff1991)\
**Replies:** 16\
**Last updated:** [May 6, 2021, 5:00pm UTC](https://discourse.julialang.org/t/code-runtime-constantly-increasing-with-time/60437 "2021-05-06T17:00:56Z")

</div>

Hello Everyone, I am fairly new to Julia, so sorry if the problem I would like to ask about may seem a bit general. I have actually written a plasma simulation code which is unfortunately too much detailed and consisti…

---

## [Performance of DataFrames' subset and ByRow](https://discourse.julialang.org/t/performance-of-dataframes-subset-and-byrow/60577)

<div class="topic-metadata">

**Author:** [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Replies:** 10\
**Last updated:** [May 5, 2021, 2:31pm UTC](https://discourse.julialang.org/t/performance-of-dataframes-subset-and-byrow/60577 "2021-05-05T14:31:04Z")

</div>

What’s the difference between ByRow and an anonyomous function like julia\> subset(df, :x =\> (x -\> x .== 0)) 3×1 DataFrame Row │ x │ Float64 ─────┼───────── 1 │ 0.0 2 │ 0.0 3 │ 0.0

---

## [DataFrames vs ndsparse for indexed data](https://discourse.julialang.org/t/dataframes-vs-ndsparse-for-indexed-data/60553)

<div class="topic-metadata">

**Author:** [@jekyllstein](https://discourse.julialang.org/u/jekyllstein)\
**Replies:** 1\
**Last updated:** [May 5, 2021, 9:44am UTC](https://discourse.julialang.org/t/dataframes-vs-ndsparse-for-indexed-data/60553 "2021-05-05T09:44:36Z")

</div>

With the release of DataFrames 1.0 I was curious about the performance benefits of accessing data with it vs something like an indexed table. The example would be having tabular data with a column and wanting to return …

---

## [Profile until buffer is full](https://discourse.julialang.org/t/profile-until-buffer-is-full/60480)

<div class="topic-metadata">

**Author:** [@goretkin](https://discourse.julialang.org/u/goretkin)\
**Replies:** 1\
**Last updated:** [May 5, 2021, 5:45am UTC](https://discourse.julialang.org/t/profile-until-buffer-is-full/60480 "2021-05-05T05:45:09Z")

</div>

function busy(n) a = 0.0 for i = 1:n a += sin(i) a += cos(a) end a end import Profile Profile.init(; n=5000, delay=0.001) Profile.@profile busy(10^7) Profile.fetch() shows that the buffe…

---

## [Efficient GPU dense-sparse matmul differentiable with Zygote](https://discourse.julialang.org/t/efficient-gpu-dense-sparse-matmul-differentiable-with-zygote/60502)

<div class="topic-metadata">

**Author:** [@jackd](https://discourse.julialang.org/u/jackd)\
**Replies:** 2\
**Last updated:** [May 5, 2021, 5:36am UTC](https://discourse.julialang.org/t/efficient-gpu-dense-sparse-matmul-differentiable-with-zygote/60502 "2021-05-05T05:36:17Z")

</div>

I’m trying to train some deep learning graph models and I’m looking for an efficient way of performing a dense-sparse matrix product on GPU that’s Zygote-differentiable with respect to entries of the dense matrix. I was …

---

## [Threading with @views and @tensor](https://discourse.julialang.org/t/threading-with-views-and-tensor/60466)

<div class="topic-metadata">

**Author:** [@Aroeira](https://discourse.julialang.org/u/Aroeira)\
**Replies:** 6\
**Last updated:** [May 4, 2021, 7:27pm UTC](https://discourse.julialang.org/t/threading-with-views-and-tensor/60466 "2021-05-04T19:27:34Z")

</div>

Hello, I am working on a code where array views are used in tensor contractions. I had written a similar one before and I was able to make it fast with the threading tools available in Julia, namely @sync and @spawn. Ho…

---

## [Multithreading @threads inside @spawn](https://discourse.julialang.org/t/multithreading-threads-inside-spawn/60491)

<div class="topic-metadata">

**Author:** [@Paul\_McVay](https://discourse.julialang.org/u/Paul_McVay)\
**Replies:** 2\
**Last updated:** [May 4, 2021, 2:57am UTC](https://discourse.julialang.org/t/multithreading-threads-inside-spawn/60491 "2021-05-04T02:57:46Z")

</div>

Are threads inside a spawn supposed to find empty threads to use? For example, my function uses @threads to perform 3 10 second sleeps in 10 seconds total. If I then try to spawn 3 of these function calls, ideally I woul…

---

## [Vector of pointers to struct array elements](https://discourse.julialang.org/t/vector-of-pointers-to-struct-array-elements/60417)

<div class="topic-metadata">

**Author:** [@vitelot](https://discourse.julialang.org/u/vitelot)\
**Replies:** 6\
**Last updated:** [May 2, 2021, 1:28pm UTC](https://discourse.julialang.org/t/vector-of-pointers-to-struct-array-elements/60417 "2021-05-02T13:28:48Z")

</div>

Hi, I’m trying to avoid multiple vector allocations to speed up the weighted sampling of a vector of structs: using StatsBase function chooseBox(room::Vector{Box}) v = \[x.k for x in room\] sample(room, Weights(v)…

---

## [Unexpected ERROR: UndefVarError: a not defined](https://discourse.julialang.org/t/unexpected-error-undefvarerror-a-not-defined/60379)

<div class="topic-metadata">

**Author:** [@M0ran](https://discourse.julialang.org/u/M0ran)\
**Replies:** 8\
**Last updated:** [May 1, 2021, 7:40pm UTC](https://discourse.julialang.org/t/unexpected-error-undefvarerror-a-not-defined/60379 "2021-05-01T19:40:52Z")

</div>

Hey, I’m new to Julia and I have to program the game “paper soccer” for school. It’s almost finished, but now I got this “UndefVarError: a not defined” error. Since I’ve always adapted my code step by step, I really don’…

---

## [Revisiting Rock, Paper, Scissors](https://discourse.julialang.org/t/revisiting-rock-paper-scissors/60347)

<div class="topic-metadata">

**Author:** [@JeffreySarnoff](https://discourse.julialang.org/u/JeffreySarnoff)\
**Replies:** 5\
**Last updated:** [May 1, 2021, 12:22am UTC](https://discourse.julialang.org/t/revisiting-rock-paper-scissors/60347 "2021-05-01T00:22:31Z")

</div>

In 2017 @giordano (with 2019 @Mason update) wrote about implementing Rock, Paper, Scissors. Using v1.7 or v1.6, can we do this any better (more: elegantly, performantly, type-stable, gamelike)? Are there new (or better…

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

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