# Performance

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

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

**Page:** 85

---

## [Why is minimum so much faster than argmin?](https://discourse.julialang.org/t/why-is-minimum-so-much-faster-than-argmin/66814)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 11\
**Last updated:** [August 23, 2021, 11:40am UTC](https://discourse.julialang.org/t/why-is-minimum-so-much-faster-than-argmin/66814 "2021-08-23T11:40:22Z")

</div>

Interesting behavior - minimum is about 4x faster than argmin. Perhaps it knows how to use more cores? The question came up from the HoJ Discord server. julia\> y = rand(100\_000); julia\> @btime argmin($y); 181.410 μs …

---

## [How to dispatch this serializer function?](https://discourse.julialang.org/t/how-to-dispatch-this-serializer-function/65981)

<div class="topic-metadata">

**Author:** [@Bardo](https://discourse.julialang.org/u/Bardo)\
**Replies:** 37\
**Last updated:** [August 23, 2021, 5:24am UTC](https://discourse.julialang.org/t/how-to-dispatch-this-serializer-function/65981 "2021-08-23T05:24:58Z")

</div>

""" io = serialize(v) reinterprets a Julia object into a series of bytes. An exercise in multiple dispatch style. Based on https://de.mathworks.com/matlabcentral/fileexchange/29457-serialize-deserialize and "julianized…

---

## [Minimum Mode Problem: minimum number - maximum repetition](https://discourse.julialang.org/t/minimum-mode-problem-minimum-number-maximum-repetition/66749)

<div class="topic-metadata">

**Author:** [@karalis1](https://discourse.julialang.org/u/karalis1)\
**Replies:** 7\
**Last updated:** [August 22, 2021, 2:18pm UTC](https://discourse.julialang.org/t/minimum-mode-problem-minimum-number-maximum-repetition/66749 "2021-08-22T14:18:57Z")

</div>

Hey guys, is there a performant way to solve this problem in julia? Given a vector \[1…n\] return the minimum number that has the highest repetition examples: \[1, 3, 3, 2, 3, 4\] → should return 3 because it’s the most r…

---

## [Generated functions for performance auto-tuning](https://discourse.julialang.org/t/generated-functions-for-performance-auto-tuning/66821)

<div class="topic-metadata">

**Author:** [@cscherrer](https://discourse.julialang.org/u/cscherrer)\
**Replies:** 7\
**Last updated:** [August 23, 2021, 2:31am UTC](https://discourse.julialang.org/t/generated-functions-for-performance-auto-tuning/66821 "2021-08-23T02:31:22Z")

</div>

To get the best performance across different inputs, we often have multiple implementations, and choose which one to use based on the input given. For example, for array traversals we may want to unroll loops for small a…

---

## [Any suggestions for speeding this simple scalar function up?](https://discourse.julialang.org/t/any-suggestions-for-speeding-this-simple-scalar-function-up/66748)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 36\
**Last updated:** [August 22, 2021, 2:35pm UTC](https://discourse.julialang.org/t/any-suggestions-for-speeding-this-simple-scalar-function-up/66748 "2021-08-22T14:35:24Z")

</div>

Hi! I’ve been playing around calculating this expression: P = b \* ((rho/rho0)^gamma - 1) Where values for b are shown how to be calculated in the code (see bottom spoiler). Running the different variants I have of the…

---

## [Unexpected Allocation with Iterator Extension](https://discourse.julialang.org/t/unexpected-allocation-with-iterator-extension/66566)

<div class="topic-metadata">

**Author:** [@pulsipher](https://discourse.julialang.org/u/pulsipher)\
**Replies:** 2\
**Last updated:** [August 22, 2021, 3:04am UTC](https://discourse.julialang.org/t/unexpected-allocation-with-iterator-extension/66566 "2021-08-22T03:04:57Z")

</div>

I am trying to implement an iterator that acts on heterogenous types whose elements may or may not need to iterated over themselves. Hence, this is sort of a nested iterator. However, I keep running into unexpected alloc…

---

## [Julia implementation of seqperiod (from MATLAB)](https://discourse.julialang.org/t/julia-implementation-of-seqperiod-from-matlab/66791)

<div class="topic-metadata">

**Author:** [@MathGuy](https://discourse.julialang.org/u/MathGuy)\
**Replies:** 12\
**Last updated:** [August 21, 2021, 11:50pm UTC](https://discourse.julialang.org/t/julia-implementation-of-seqperiod-from-matlab/66791 "2021-08-21T23:50:37Z")

</div>

Hi! I’ve been playing with Julia for a while. Suppose you are given a 2000-by10000 Matrix of Float64 type and were told to find the periodicity of each of the 10k columns and store it in some variable. Note that, very c…

---

## [Efficient use of @turbo for linear algebra operations (LoopVectorization.jl)](https://discourse.julialang.org/t/efficient-use-of-turbo-for-linear-algebra-operations-loopvectorization-jl/66771)

<div class="topic-metadata">

**Author:** [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Replies:** 6\
**Last updated:** [August 21, 2021, 3:04pm UTC](https://discourse.julialang.org/t/efficient-use-of-turbo-for-linear-algebra-operations-loopvectorization-jl/66771 "2021-08-21T15:04:55Z")

</div>

Hi, I am trying to understand how to use the @turbo macro from LoopVectorization.jl efficiently. I am starting with a generalised dot product, as implemented in LinearAlgebra. I basically took the code from LinearAlgeb…

---

## [Avoid memory allocation in passing arrays](https://discourse.julialang.org/t/avoid-memory-allocation-in-passing-arrays/66560)

<div class="topic-metadata">

**Author:** [@Frisus95](https://discourse.julialang.org/u/Frisus95)\
**Replies:** 14\
**Last updated:** [August 21, 2021, 2:14am UTC](https://discourse.julialang.org/t/avoid-memory-allocation-in-passing-arrays/66560 "2021-08-21T02:14:46Z")

</div>

Hello everyone, I’m trying to figure out how to avoid unnecessary memory allocation in the following example (I’m using the Tullio package, but I think it also applies in more general contexts): using Tullio using Loop…

---

## [Can this contraction run faster without memory allocation?](https://discourse.julialang.org/t/can-this-contraction-run-faster-without-memory-allocation/66761)

<div class="topic-metadata">

**Author:** [@Frisus95](https://discourse.julialang.org/u/Frisus95)\
**Replies:** 0\
**Last updated:** [August 21, 2021, 1:51am UTC](https://discourse.julialang.org/t/can-this-contraction-run-faster-without-memory-allocation/66761 "2021-08-21T01:51:42Z")

</div>

Hello everyone! is it possible to make this code run faster and not allocate more memory than necessary? julia\> function funza(Tensor, indices) result = 0.0 for i = 1:5 T1 = Tensor\[indices\[1\],in…

---

## [How do findall ,findmax ,findmin, argmax, argmin work on SparseArrays/SparseMatrixCSC](https://discourse.julialang.org/t/how-do-findall-findmax-findmin-argmax-argmin-work-on-sparsearrays-sparsematrixcsc/66735)

<div class="topic-metadata">

**Author:** [@yewalenikhil65](https://discourse.julialang.org/u/yewalenikhil65)\
**Replies:** 3\
**Last updated:** [August 20, 2021, 5:37pm UTC](https://discourse.julialang.org/t/how-do-findall-findmax-findmin-argmax-argmin-work-on-sparsearrays-sparsematrixcsc/66735 "2021-08-20T17:37:49Z")

</div>

Do findall findmax ,findmin, argmax, argmin work on SparseArrays by convert sparse to Matrix type before doing operations on these functions? If yes, is the computational cost too much of converting?

---

## [Memory Allocation on Array Element Operations](https://discourse.julialang.org/t/memory-allocation-on-array-element-operations/66676)

<div class="topic-metadata">

**Author:** [@MatthiasSchneller](https://discourse.julialang.org/u/MatthiasSchneller)\
**Replies:** 2\
**Last updated:** [August 19, 2021, 1:44pm UTC](https://discourse.julialang.org/t/memory-allocation-on-array-element-operations/66676 "2021-08-19T13:44:53Z")

</div>

Hi, I currently have the problem that i want to add elements from a Vector to other, more or less random, elements of a matrix. Because i have to do this a lot of times i wanted to improve the performance of it. And tha…

---

## [Speed comparison matrix multiplication in Julia](https://discourse.julialang.org/t/speed-comparison-matrix-multiplication-in-julia/66656)

<div class="topic-metadata">

**Author:** [@sivakon](https://discourse.julialang.org/u/sivakon)\
**Replies:** 45\
**Last updated:** [August 19, 2021, 12:33pm UTC](https://discourse.julialang.org/t/speed-comparison-matrix-multiplication-in-julia/66656 "2021-08-19T12:33:30Z")

</div>

Optimized version in Julia. (126ms opt. Julia vs. 676ms in Jax - Int32) (521ms opt. Julia vs. 2.2s in Jax - Int64) Using tullio Int32 using Tullio, BenchmarkTools, LoopVectorization # Row major a = Array(reshape(Int32…

---

## [LMI, Control system, Robust Control Adaptive Controller](https://discourse.julialang.org/t/lmi-control-system-robust-control-adaptive-controller/65626)

<div class="topic-metadata">

**Author:** [@Asifalimaitlo\_Asifal](https://discourse.julialang.org/u/Asifalimaitlo_Asifal)\
**Replies:** 13\
**Last updated:** [August 19, 2021, 9:31am UTC](https://discourse.julialang.org/t/lmi-control-system-robust-control-adaptive-controller/65626 "2021-08-19T09:31:23Z")

</div>

Piecewise gain-scheduled L2 control

---

## [Allocation-free type hiding?](https://discourse.julialang.org/t/allocation-free-type-hiding/66609)

<div class="topic-metadata">

**Author:** [@pablosanjose](https://discourse.julialang.org/u/pablosanjose)\
**Replies:** 14\
**Last updated:** [August 19, 2021, 5:30am UTC](https://discourse.julialang.org/t/allocation-free-type-hiding/66609 "2021-08-19T05:30:37Z")

</div>

I’m trying to reduce latency in a package, and was intrigued by the mention of “type hiding” in the Dataframes.jl Juliacon talk by @bkamins (State of DataFrames.jl - YouTube). As I understand it, type hiding consists of…

---

## [Accessing profiling data programmatically](https://discourse.julialang.org/t/accessing-profiling-data-programmatically/66355)

<div class="topic-metadata">

**Author:** [@goretkin](https://discourse.julialang.org/u/goretkin)\
**Replies:** 0\
**Last updated:** [August 13, 2021, 7:49pm UTC](https://discourse.julialang.org/t/accessing-profiling-data-programmatically/66355 "2021-08-13T19:49:29Z")

</div>

I did not find an example of querying Julia profiling data for e.g. the number of samples that hit a given function. I want to post what I’m using in case it’s useful to anyone searching: using Profile using FlameGraphs…

---

## [Speeding up sort along an array dimension](https://discourse.julialang.org/t/speeding-up-sort-along-an-array-dimension/66468)

<div class="topic-metadata">

**Author:** [@johnbb](https://discourse.julialang.org/u/johnbb)\
**Replies:** 11\
**Last updated:** [August 18, 2021, 1:33pm UTC](https://discourse.julialang.org/t/speeding-up-sort-along-an-array-dimension/66468 "2021-08-18T13:33:11Z")

</div>

I have large arrays which I would like to sort along a single dimension of small size as in the example below. Any suggestions to increase performance would be welcome. using BenchmarkTools a = rand(Float32, 1000, 1000,…

---

## [Running Julia with native Multithreading vs in Seperate Processes](https://discourse.julialang.org/t/running-julia-with-native-multithreading-vs-in-seperate-processes/66594)

<div class="topic-metadata">

**Author:** [@Paul\_Depping](https://discourse.julialang.org/u/Paul_Depping)\
**Replies:** 1\
**Last updated:** [August 18, 2021, 10:58am UTC](https://discourse.julialang.org/t/running-julia-with-native-multithreading-vs-in-seperate-processes/66594 "2021-08-18T10:58:55Z")

</div>

Hello, I’ve measured the performance of a Script which: Reads from a file of some binary format Does a binary search of what it read within a big sorted list containing every value and then fills in a Vector{UInt8} th…

---

## [Julia Beginner (from Python): Numba outperforms Julia in rewrite. Any tips to improve performance?](https://discourse.julialang.org/t/julia-beginner-from-python-numba-outperforms-julia-in-rewrite-any-tips-to-improve-performance/66414)

<div class="topic-metadata">

**Author:** [@rmeinl](https://discourse.julialang.org/u/rmeinl)\
**Replies:** 56\
**Last updated:** [August 18, 2021, 12:00am UTC](https://discourse.julialang.org/t/julia-beginner-from-python-numba-outperforms-julia-in-rewrite-any-tips-to-improve-performance/66414 "2021-08-18T00:00:28Z")

</div>

Hey! I’m new to Julia (coming from Python) and was trying to benchmark Julia against a part of the apricot python package (submodular optimization). Unfortunately the Python version (using numba) is still a bit faster (1…

---

## [22 seconds to 3 and now more: Let's fix all of the DifferentialEquations.jl + universe compile times!](https://discourse.julialang.org/t/22-seconds-to-3-and-now-more-lets-fix-all-of-the-differentialequations-jl-universe-compile-times/66313)

<div class="topic-metadata">

**Author:** [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Replies:** 6\
**Last updated:** [August 17, 2021, 9:18pm UTC](https://discourse.julialang.org/t/22-seconds-to-3-and-now-more-lets-fix-all-of-the-differentialequations-jl-universe-compile-times/66313 "2021-08-17T21:18:50Z")

</div>

These are the JuliaCon hackathon results for SciML compile time issues, with major help from @tim.holy (and more to be announced soon…). This is a repost of 22 seconds to 3 and now more: Let's fix all of the Differential…

---

## [Improving function performance - Broadcasting vs Loops](https://discourse.julialang.org/t/improving-function-performance-broadcasting-vs-loops/66537)

<div class="topic-metadata">

**Author:** [@jpmorr](https://discourse.julialang.org/u/jpmorr)\
**Replies:** 14\
**Last updated:** [August 17, 2021, 1:02pm UTC](https://discourse.julialang.org/t/improving-function-performance-broadcasting-vs-loops/66537 "2021-08-17T13:02:57Z")

</div>

I’m slowly learning some of the tricks that can make julia code quicker. Coming from python I still find it strange to write a loop instead of some vectorised but it seems that sometimes that the loop is the quicker opti…

---

## [BenchmarkGallery?](https://discourse.julialang.org/t/benchmarkgallery/66542)

<div class="topic-metadata">

**Author:** [@SteffenPL](https://discourse.julialang.org/u/SteffenPL)\
**Replies:** 1\
**Last updated:** [August 17, 2021, 11:24am UTC](https://discourse.julialang.org/t/benchmarkgallery/66542 "2021-08-17T11:24:40Z")

</div>

I thought about collecting Julia code snippets and sort and assemble them into a public git repository. Does something like this already exist? I’m happy to start something, but before I do so, ideas would be very wel…

---

## [Object Detection in Julia](https://discourse.julialang.org/t/object-detection-in-julia/65115)

<div class="topic-metadata">

**Author:** [@ppkvm](https://discourse.julialang.org/u/ppkvm)\
**Replies:** 6\
**Last updated:** [August 17, 2021, 10:17am UTC](https://discourse.julialang.org/t/object-detection-in-julia/65115 "2021-08-17T10:17:35Z")

</div>

I would like to see examples of Object Detection using YOLO and SSD implemented in Julia. Has anyone tried this before?

---

## [Memory allocation while using @views](https://discourse.julialang.org/t/memory-allocation-while-using-views/66482)

<div class="topic-metadata">

**Author:** [@aramgharibyan](https://discourse.julialang.org/u/aramgharibyan)\
**Replies:** 5\
**Last updated:** [August 16, 2021, 3:11pm UTC](https://discourse.julialang.org/t/memory-allocation-while-using-views/66482 "2021-08-16T15:11:39Z")

</div>

I found an issue while using @views, which may help others speed up their code. Let us consider this example of code. len = 5000 const arr1 = Array{Float64, 2}(undef, 10, len) const arr2 = Array{Float64, 2}(undef, 10, l…

---

## [@time and @benchmark give different results](https://discourse.julialang.org/t/time-and-benchmark-give-different-results/66374)

<div class="topic-metadata">

**Author:** [@Ross\_Boylan](https://discourse.julialang.org/u/Ross_Boylan)\
**Replies:** 6\
**Last updated:** [August 16, 2021, 5:18pm UTC](https://discourse.julialang.org/t/time-and-benchmark-give-different-results/66374 "2021-08-16T17:18:37Z")

</div>

\[Corrected: ms is 10^{-3} seconds and μs is 10^{-6}.\] I’m evaluating 2 algorithms for doing roughly the same thing, using @time and @benchmark. The ratio of times between the 2 timing methods differs by a factor of rou…

---

## [OutOfMemoryError with sparse A'\*A](https://discourse.julialang.org/t/outofmemoryerror-with-sparse-a-a/65911)

<div class="topic-metadata">

**Author:** [@Thomas](https://discourse.julialang.org/u/Thomas)\
**Replies:** 9\
**Last updated:** [August 16, 2021, 9:55am UTC](https://discourse.julialang.org/t/outofmemoryerror-with-sparse-a-a/65911 "2021-08-16T09:55:38Z")

</div>

I have to multiply large sparse matrices in the following orthogonal projection orthProject(A::SparseMatricCSC, v::SparseVector) = A \* ((A' \* A) \\ Vector(A' \* v)) but due I got this error ERROR: OutOfMemoryError() Sta…

---

## [Nbabel nbody integrator speed up](https://discourse.julialang.org/t/nbabel-nbody-integrator-speed-up/51712)

<div class="topic-metadata">

**Author:** [@darleybarreto](https://discourse.julialang.org/u/darleybarreto)\
**Replies:** 64\
**Last updated:** [August 16, 2021, 5:17am UTC](https://discourse.julialang.org/t/nbabel-nbody-integrator-speed-up/51712 "2021-08-16T05:17:29Z")

</div>

Hi folks, I found this implementation of a Nbabel integrator in Julia, which I believe it’s a very simple one. The author report a runtime of 2.57s against 0.48s of Pythran. Would any of you help me improve this? I belie…

---

## [Surface command in Julia](https://discourse.julialang.org/t/surface-command-in-julia/66378)

<div class="topic-metadata">

**Author:** [@Manisha\_07](https://discourse.julialang.org/u/Manisha_07)\
**Replies:** 7\
**Last updated:** [August 16, 2021, 5:55am UTC](https://discourse.julialang.org/t/surface-command-in-julia/66378 "2021-08-16T05:55:05Z")

</div>

MethodError: no method matching optimize\_ticks(::Float64, ::Float64; k\_min=4, k\_max=8, scale=:identity) Closest candidates are: optimize\_ticks(::T, ::T; extend\_ticks, Q, k\_min, k\_max, k\_ideal, granularity\_weight, simpl…

---

## [Radial basis function](https://discourse.julialang.org/t/radial-basis-function/66446)

<div class="topic-metadata">

**Author:** [@Manisha\_07](https://discourse.julialang.org/u/Manisha_07)\
**Replies:** 0\
**Last updated:** [August 15, 2021, 10:37pm UTC](https://discourse.julialang.org/t/radial-basis-function/66446 "2021-08-15T22:37:09Z")

</div>

Hello Guys Now i have come up with new doubts I need to use 2nd order differencial equation and used radial basis function for approximating the solution Please let me know how to solve 2nd order differencial equation…

---

## [Faster counting of sequences](https://discourse.julialang.org/t/faster-counting-of-sequences/66359)

<div class="topic-metadata">

**Author:** [@danielw2904](https://discourse.julialang.org/u/danielw2904)\
**Replies:** 10\
**Last updated:** [August 15, 2021, 3:00pm UTC](https://discourse.julialang.org/t/faster-counting-of-sequences/66359 "2021-08-15T15:00:14Z")

</div>

I have a problem in which I am trying to figure out how many items were first selected by user i and later by user j for all users. My idea was to create a sparse matrix M with n-users \\times n-users in which the rows s…

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

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