# Performance

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

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

**Page:** 54

---

## [AES-NI support](https://discourse.julialang.org/t/aes-ni-support/90871)

<div class="topic-metadata">

**Author:** [@hros](https://discourse.julialang.org/u/hros)\
**Replies:** 0\
**Last updated:** [November 26, 2022, 11:36pm UTC](https://discourse.julialang.org/t/aes-ni-support/90871 "2022-11-26T23:36:37Z")

</div>

There are several packages that implement AES Do any of the packages support hardware acceleration (AES-NI)? For example, OpenSSL\_jll is built with BinaryBuilder, does BinaryBuilder support AES-NI?

---

## [File IO Buffers too small?](https://discourse.julialang.org/t/file-io-buffers-too-small/89931)

<div class="topic-metadata">

**Author:** [@mwlidar](https://discourse.julialang.org/u/mwlidar)\
**Replies:** 14\
**Last updated:** [November 25, 2022, 5:05pm UTC](https://discourse.julialang.org/t/file-io-buffers-too-small/89931 "2022-11-25T17:05:12Z")

</div>

I typically have the task to read and process large binary data files consisting of relatively small consecutive records (\< 30 kB). If I read each record one after the other the read performance lacks far behind of what …

---

## [Updating / adding functions together](https://discourse.julialang.org/t/updating-adding-functions-together/90817)

<div class="topic-metadata">

**Author:** [@tsojtc](https://discourse.julialang.org/u/tsojtc)\
**Replies:** 0\
**Last updated:** [November 25, 2022, 4:44pm UTC](https://discourse.julialang.org/t/updating-adding-functions-together/90817 "2022-11-25T16:44:23Z")

</div>

I am working on a problem where I have a continuous real valued function, e.g. a solution to an ODE, and I want to be able to update it multiple times by adding other continuous functions, which are calculated by code ru…

---

## [Sort allocates twice more memory](https://discourse.julialang.org/t/sort-allocates-twice-more-memory/90756)

<div class="topic-metadata">

**Author:** [@gitboy16](https://discourse.julialang.org/u/gitboy16)\
**Replies:** 1\
**Last updated:** [November 25, 2022, 3:25pm UTC](https://discourse.julialang.org/t/sort-allocates-twice-more-memory/90756 "2022-11-25T15:25:38Z")

</div>

Hi, It seems the sort function allocates twice more memory in master vs 1.8.3: using BenchmarkTools x = rand(10^8); @btime sort($x); In 1.8.3 I get 2 allocations 762 MiB vs 6 allocations 1.49GiB in master. Is that co…

---

## [Allocations (again...)](https://discourse.julialang.org/t/allocations-again/90780)

<div class="topic-metadata">

**Author:** [@aaraujo71](https://discourse.julialang.org/u/aaraujo71)\
**Replies:** 15\
**Last updated:** [November 25, 2022, 2:26pm UTC](https://discourse.julialang.org/t/allocations-again/90780 "2022-11-25T14:26:34Z")

</div>

When I run using BenchmarkTools function test(x, Y) sum!(x, Y') return nothing end x = rand(Float64, 100) Y = rand(Float64, 1, 100) @btime(test(x, Y)) I get the following: 367.952 ns (2 allocations: 96 bytes…

---

## [How to avoid compiling methods for different types when @nospecialize doesn't seem to work?](https://discourse.julialang.org/t/how-to-avoid-compiling-methods-for-different-types-when-nospecialize-doesnt-seem-to-work/90677)

<div class="topic-metadata">

**Author:** [@SortofDamocles](https://discourse.julialang.org/u/SortofDamocles)\
**Replies:** 10\
**Last updated:** [November 23, 2022, 11:37pm UTC](https://discourse.julialang.org/t/how-to-avoid-compiling-methods-for-different-types-when-nospecialize-doesnt-seem-to-work/90677 "2022-11-23T23:37:47Z")

</div>

Consider the following struct: struct MetaTuple data::Tuple{Vararg{Union{Tuple{}, Tuple{Int16}, Tuple{Int16, Int16}, Tuple{Int16, Int16, Int16}, Tuple{Int16, Int16, Int16, Int16}}}} end Its data is a tuple of tuple…

---

## [Modular multiplication without overflow](https://discourse.julialang.org/t/modular-multiplication-without-overflow/90421)

<div class="topic-metadata">

**Author:** [@Lilith](https://discourse.julialang.org/u/Lilith)\
**Replies:** 32\
**Last updated:** [November 23, 2022, 12:08pm UTC](https://discourse.julialang.org/t/modular-multiplication-without-overflow/90421 "2022-11-23T12:08:16Z")

</div>

Let’s say I have three integers of the same type and want to compute (a \* b) % c. a \* b might overflow producing wrong results even though the mathematically correct answer (e.g. using BigInts) would not overflow. What i…

---

## [Extremely slow \`invoke\` when inlined](https://discourse.julialang.org/t/extremely-slow-invoke-when-inlined/90665)

<div class="topic-metadata">

**Author:** [@mateuszbaran](https://discourse.julialang.org/u/mateuszbaran)\
**Replies:** 3\
**Last updated:** [November 22, 2022, 9:00pm UTC](https://discourse.julialang.org/t/extremely-slow-invoke-when-inlined/90665 "2022-11-22T21:00:50Z")

</div>

Consider the following code: function e() els = Any\[\[1\], 10.0\] return rand(els) end function f() a = e() g(a) end function g(a) return invoke(\*, Tuple{supertype(typeof(a)),Float64}, a, 10.0) end T…

---

## [Why does this function allocate memory?](https://discourse.julialang.org/t/why-does-this-function-allocate-memory/90624)

<div class="topic-metadata">

**Author:** [@Nathaniel](https://discourse.julialang.org/u/Nathaniel)\
**Replies:** 6\
**Last updated:** [November 22, 2022, 9:18am UTC](https://discourse.julialang.org/t/why-does-this-function-allocate-memory/90624 "2022-11-22T09:18:17Z")

</div>

The Performance tips page in the documentation gives the following example of a function that allocates memory unexpectedly: julia\> x = rand(1000); julia\> function sum\_global() s = 0.0 for i in x …

---

## [Looping through binary numbers](https://discourse.julialang.org/t/looping-through-binary-numbers/90597)

<div class="topic-metadata">

**Author:** [@lrnv](https://discourse.julialang.org/u/lrnv)\
**Replies:** 16\
**Last updated:** [November 21, 2022, 11:40pm UTC](https://discourse.julialang.org/t/looping-through-binary-numbers/90597 "2022-11-21T23:40:06Z")

</div>

Hey, In Copulas.jl, I want to compute the measure a copula assignes to a hyperbox \[u,v\]. Basically, the following function is doing what i want : using Copulas # Based on Computing the {{Volume}} of {\\emph{n}} -{{Dim…

---

## [MLJ Tuning and Hyperparameters , Regression](https://discourse.julialang.org/t/mlj-tuning-and-hyperparameters-regression/90546)

<div class="topic-metadata">

**Author:** [@Mr.Benz](https://discourse.julialang.org/u/Mr.Benz)\
**Replies:** 0\
**Last updated:** [November 20, 2022, 4:16pm UTC](https://discourse.julialang.org/t/mlj-tuning-and-hyperparameters-regression/90546 "2022-11-20T16:16:01Z")

</div>

I started with julia , new to data science. i have a quetion on MLJ tuning ang iteratied model. in a loop , Do we need to do TunedModel + IteratedModel +evaluate or IteratedModel +TunedModel +evaluate which is best wa…

---

## [Experiments in speeding up runtime dispatch for integer value specialization](https://discourse.julialang.org/t/experiments-in-speeding-up-runtime-dispatch-for-integer-value-specialization/90355)

<div class="topic-metadata">

**Author:** [@user664303](https://discourse.julialang.org/u/user664303)\
**Replies:** 28\
**Last updated:** [November 18, 2022, 10:45pm UTC](https://discourse.julialang.org/t/experiments-in-speeding-up-runtime-dispatch-for-integer-value-specialization/90355 "2022-11-18T22:45:22Z")

</div>

I am trying to develop a package that needs to operate on small matrices, the size of which isn’t known at runtime. Nevertheless, there is a lot of performance to be gained by specializing/parameterizing particular funct…

---

## [Any suggestion on how to increase CPU usage in Flux?](https://discourse.julialang.org/t/any-suggestion-on-how-to-increase-cpu-usage-in-flux/90467)

<div class="topic-metadata">

**Author:** [@tiZ](https://discourse.julialang.org/u/tiZ)\
**Replies:** 0\
**Last updated:** [November 18, 2022, 5:26pm UTC](https://discourse.julialang.org/t/any-suggestion-on-how-to-increase-cpu-usage-in-flux/90467 "2022-11-18T17:26:03Z")

</div>

Hi, I open this topic because I found that sometimes Flux can use 100% of the CPU, but sometimes it only uses half. For example, here is two demo model, model A have fewer hidden layers than B. Trainning model A, the C…

---

## [Are "optimized" single thread algorithms typically different than "optimized" multithread implementations?](https://discourse.julialang.org/t/are-optimized-single-thread-algorithms-typically-different-than-optimized-multithread-implementations/90412)

<div class="topic-metadata">

**Author:** [@JohnS](https://discourse.julialang.org/u/JohnS)\
**Replies:** 8\
**Last updated:** [November 18, 2022, 9:33am UTC](https://discourse.julialang.org/t/are-optimized-single-thread-algorithms-typically-different-than-optimized-multithread-implementations/90412 "2022-11-18T09:33:41Z")

</div>

Thanks for your help everyone! I’m relatively new to multithreading and I’m probably wrong, but it seems like the fastest function for the desired output using a single thread doesn’t parallelize well. However, a for-lo…

---

## [Improving pullback speed with list comprehension](https://discourse.julialang.org/t/improving-pullback-speed-with-list-comprehension/90361)

<div class="topic-metadata">

**Author:** [@mhar](https://discourse.julialang.org/u/mhar)\
**Replies:** 4\
**Last updated:** [November 17, 2022, 8:50pm UTC](https://discourse.julialang.org/t/improving-pullback-speed-with-list-comprehension/90361 "2022-11-17T20:50:08Z")

</div>

Here is a MWE of the function I have that needs AD. N = 100 function compute\_many\_prods(f, g) return \[f \* g \* i for i = 1:N\] end function compute\_many\_prods2(f, g) return compute\_many\_prods(f, g) end function Ch…

---

## [Any suggestion for speeding up my function?](https://discourse.julialang.org/t/any-suggestion-for-speeding-up-my-function/90393)

<div class="topic-metadata">

**Author:** [@tiZ](https://discourse.julialang.org/u/tiZ)\
**Replies:** 11\
**Last updated:** [November 17, 2022, 5:39pm UTC](https://discourse.julialang.org/t/any-suggestion-for-speeding-up-my-function/90393 "2022-11-17T17:39:01Z")

</div>

Hi, I have a function accepts 4 matrixs and do some caculations, it works well but very slow. I wonder to know how to improve its performance? I’m wondering if it’s possible to be faster, I just know that using @. the…

---

## [Mysterious allocations in nested scalar loops](https://discourse.julialang.org/t/mysterious-allocations-in-nested-scalar-loops/90380)

<div class="topic-metadata">

**Author:** [@gtgt](https://discourse.julialang.org/u/gtgt)\
**Replies:** 5\
**Last updated:** [November 17, 2022, 12:59pm UTC](https://discourse.julialang.org/t/mysterious-allocations-in-nested-scalar-loops/90380 "2022-11-17T12:59:29Z")

</div>

I am writing some code to solve Project Euler #60. Given an upper bound N, the program uses 5 nested for loops to find the smallest sum of quintuples (p\_1, p\_2, p\_3, p\_4, p\_5) of prime numbers, p\_i \\leqslant N such that …

---

## [Interpreting output of Profile: Finding where code is called](https://discourse.julialang.org/t/interpreting-output-of-profile-finding-where-code-is-called/90396)

<div class="topic-metadata">

**Author:** [@renatobellotti](https://discourse.julialang.org/u/renatobellotti)\
**Replies:** 1\
**Last updated:** [November 17, 2022, 12:04pm UTC](https://discourse.julialang.org/t/interpreting-output-of-profile-finding-where-code-is-called/90396 "2022-11-17T12:04:18Z")

</div>

Dear Julia enthusiasts, I’m currently profiling an optimisation code that relies on Optim.jl and Zygote to calculate the gradients. Interestingly, about half of the runtime seems to be spent on creating and destroying t…

---

## [Syntax error in parallel computing](https://discourse.julialang.org/t/syntax-error-in-parallel-computing/90378)

<div class="topic-metadata">

**Author:** [@marouane](https://discourse.julialang.org/u/marouane)\
**Replies:** 2\
**Last updated:** [November 17, 2022, 3:20am UTC](https://discourse.julialang.org/t/syntax-error-in-parallel-computing/90378 "2022-11-17T03:20:59Z")

</div>

I’m trying to learn parallel computing using Distributed and I tried the Pi computation as an example: using Distributed addprocs(4) function points\_inside(n) n\_in= 0 for i=1:n x,y= rand(), rand() …

---

## [Avoiding allocations of small but non-trivial arrays (work array alternative?)](https://discourse.julialang.org/t/avoiding-allocations-of-small-but-non-trivial-arrays-work-array-alternative/90084)

<div class="topic-metadata">

**Author:** [@martin.d.maas](https://discourse.julialang.org/u/martin.d.maas)\
**Replies:** 38\
**Last updated:** [November 17, 2022, 12:52am UTC](https://discourse.julialang.org/t/avoiding-allocations-of-small-but-non-trivial-arrays-work-array-alternative/90084 "2022-11-17T00:52:01Z")

</div>

Hi everyone, I’m in the process of optimizing a portion of my code that has a general problem of too much memory allocation, and consequently poor threading efficiency and overall performance. This is a series of pretty…

---

## [Creating random \`MMatrix\` with large size is too slow](https://discourse.julialang.org/t/creating-random-mmatrix-with-large-size-is-too-slow/90323)

<div class="topic-metadata">

**Author:** [@singularitti](https://discourse.julialang.org/u/singularitti)\
**Replies:** 5\
**Last updated:** [November 16, 2022, 3:57pm UTC](https://discourse.julialang.org/t/creating-random-mmatrix-with-large-size-is-too-slow/90323 "2022-11-16T15:57:52Z")

</div>

I want to create a StaticArrays.MMatrix with a somewhat medium or large size using rand, but it seems much slower than the plain Matrix and it took a long time for it to display: using StaticArray: MMatrix N = 10 m = r…

---

## [Improving performance with @sync @async macros](https://discourse.julialang.org/t/improving-performance-with-sync-async-macros/82822)

<div class="topic-metadata">

**Author:** [@mauri5566](https://discourse.julialang.org/u/mauri5566)\
**Replies:** 1\
**Last updated:** [November 16, 2022, 3:17pm UTC](https://discourse.julialang.org/t/improving-performance-with-sync-async-macros/82822 "2022-11-16T15:17:45Z")

</div>

I’m trying to parallelize this function by using @async @sync function INSR\_opt(f) function INSR0\_opt(seq) len = length(seq) res = seq\[end\] @inbounds @sync for i in range(len-2,step=-1,stop=0) @async res = f(\[…

---

## [Speed up very elemental functions](https://discourse.julialang.org/t/speed-up-very-elemental-functions/90342)

<div class="topic-metadata">

**Author:** [@Djoser42](https://discourse.julialang.org/u/Djoser42)\
**Replies:** 6\
**Last updated:** [November 16, 2022, 3:00pm UTC](https://discourse.julialang.org/t/speed-up-very-elemental-functions/90342 "2022-11-16T15:00:02Z")

</div>

Hey, I am still kind of new to Julia and I have a question about the performance and potential speed up of functions which are very elementar and/or “atomic” in my code, since they are used often and I figured that this …

---

## [Performance issues when working with dict](https://discourse.julialang.org/t/performance-issues-when-working-with-dict/74565)

<div class="topic-metadata">

**Author:** [@Deoch](https://discourse.julialang.org/u/Deoch)\
**Replies:** 11\
**Last updated:** [November 16, 2022, 2:05pm UTC](https://discourse.julialang.org/t/performance-issues-when-working-with-dict/74565 "2022-11-16T14:05:02Z")

</div>

Hello, I have some performance issues with dictionnaries, and I’m unsure about how to approach this problem. I profiled my code the other day, and I found that it spent a fair amount of time (that I wasn’t expecting) on…

---

## [Unintuitive behavior for iterator of views of a vector](https://discourse.julialang.org/t/unintuitive-behavior-for-iterator-of-views-of-a-vector/90334)

<div class="topic-metadata">

**Author:** [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Replies:** 1\
**Last updated:** [November 16, 2022, 10:00am UTC](https://discourse.julialang.org/t/unintuitive-behavior-for-iterator-of-views-of-a-vector/90334 "2022-11-16T10:00:57Z")

</div>

We are creating a simple iterator whose goal is to generate views of a given vector (something like a sliding window). However, the Julia behavior on this object is rather unituitive to me, with weird type instabilities …

---

## [Repeat CuArray (subtract 3 Vector from every row of nx3 matrix)](https://discourse.julialang.org/t/repeat-cuarray-subtract-3-vector-from-every-row-of-nx3-matrix/90291)

<div class="topic-metadata">

**Author:** [@LeN3rd](https://discourse.julialang.org/u/LeN3rd)\
**Replies:** 3\
**Last updated:** [November 15, 2022, 8:36pm UTC](https://discourse.julialang.org/t/repeat-cuarray-subtract-3-vector-from-every-row-of-nx3-matrix/90291 "2022-11-15T20:36:22Z")

</div>

How can i repeat a CuArray in a fast way? I have a 3 vector that is supposed to be subtracted from every row in a n x 3 matrix. The CPU code just transposes and repeats it, but this takes up to 3 seconds on GPU and takes…

---

## [R2r is surprisingly slower than complex fft](https://discourse.julialang.org/t/r2r-is-surprisingly-slower-than-complex-fft/90018)

<div class="topic-metadata">

**Author:** [@photor](https://discourse.julialang.org/u/photor)\
**Replies:** 7\
**Last updated:** [November 15, 2022, 7:43pm UTC](https://discourse.julialang.org/t/r2r-is-surprisingly-slower-than-complex-fft/90018 "2022-11-15T19:43:01Z")

</div>

const m=60 x=randn(m,m,m) y=deepcopy(x) p = FFTW.plan\_r2r(y,FFTW.R2HC,flags=FFTW.MEASURE) @btime mul!($y,$p,$x); gives the result 572.302 μs (138 allocations: 10.16 KiB) while const m=60 x=randn(ComplexF64,m,m,m) y…

---

## [Operations on ComposedFunctions using Symbolics.jl and in Julia in general](https://discourse.julialang.org/t/operations-on-composedfunctions-using-symbolics-jl-and-in-julia-in-general/90309)

<div class="topic-metadata">

**Author:** [@MattM](https://discourse.julialang.org/u/MattM)\
**Replies:** 0\
**Last updated:** [November 15, 2022, 6:31pm UTC](https://discourse.julialang.org/t/operations-on-composedfunctions-using-symbolics-jl-and-in-julia-in-general/90309 "2022-11-15T18:31:56Z")

</div>

Hello, I am using Symbolics.jl for a project, and would like to play around with the Operator structure. In particular, I would like to build operators such as a Lie operator, defined as :f: = \\frac{\\partial f}{\\parti…

---

## [Performance: Fast way to access numbers in Dataframes or alternatives](https://discourse.julialang.org/t/performance-fast-way-to-access-numbers-in-dataframes-or-alternatives/89884)

<div class="topic-metadata">

**Author:** [@pjuergens](https://discourse.julialang.org/u/pjuergens)\
**Replies:** 12\
**Last updated:** [November 15, 2022, 9:35am UTC](https://discourse.julialang.org/t/performance-fast-way-to-access-numbers-in-dataframes-or-alternatives/89884 "2022-11-15T09:35:43Z")

</div>

Hello together, I’m searching for a fast (or the fastest) way to access datapoints/numbers in a dataframes-like structure. I have 57 timeseries (columns) with 43800 datapoints (rows) each that are read in from a csv-fil…

---

## [Threads (including Polyester) question](https://discourse.julialang.org/t/threads-including-polyester-question/90233)

<div class="topic-metadata">

**Author:** [@Palli](https://discourse.julialang.org/u/Palli)\
**Replies:** 1\
**Last updated:** [November 14, 2022, 1:10pm UTC](https://discourse.julialang.org/t/threads-including-polyester-question/90233 "2022-11-14T13:10:15Z")

</div>

I get worse timing with threads (in the best case), and also different values, not pi, or at best if I’m lucky. I had already sped that benchmark up more than 5x, and curious if threading in some form could make even bet…

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

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