# Performance

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

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

**Page:** 62

---

## [BLAS performance testing for Julia 1.8](https://discourse.julialang.org/t/blas-performance-testing-for-julia-1-8/69520)

<div class="topic-metadata">

**Author:** [@viralbshah](https://discourse.julialang.org/u/viralbshah)\
**Replies:** 30\
**Last updated:** [July 19, 2022, 7:30am UTC](https://discourse.julialang.org/t/blas-performance-testing-for-julia-1-8/69520 "2022-07-19T07:30:38Z")

</div>

OpenBLAS had two threading related defaults that we used to set until recently, both of which are now relaxed, since openblas has improved on both these fronts: We used to build openblas with 32 max threads (at some po…

---

## [How to use all of the cpu cores in IJulia using broadcasting function?](https://discourse.julialang.org/t/how-to-use-all-of-the-cpu-cores-in-ijulia-using-broadcasting-function/84418)

<div class="topic-metadata">

**Author:** [@Phuntsho](https://discourse.julialang.org/u/Phuntsho)\
**Replies:** 4\
**Last updated:** [July 19, 2022, 5:10am UTC](https://discourse.julialang.org/t/how-to-use-all-of-the-cpu-cores-in-ijulia-using-broadcasting-function/84418 "2022-07-19T05:10:55Z")

</div>

I am relatively new to Julia and I have been exploring how to parallel process functions in IJulia. I have created a Jupyter notebook for 128 cores using the directions given here. I can confirm that it has imported all …

---

## [Speeding up mapslices](https://discourse.julialang.org/t/speeding-up-mapslices/61907)

<div class="topic-metadata">

**Author:** [@nandoconde](https://discourse.julialang.org/u/nandoconde)\
**Replies:** 0\
**Last updated:** [May 27, 2021, 9:01am UTC](https://discourse.julialang.org/t/speeding-up-mapslices/61907 "2021-05-27T09:01:28Z")

</div>

Hello! I was trying to perform a matrix inversion in a 3-D array along the third dimension (more info here) and reached two possible solutions. First solution – Manual inversion I am not worrying too much about strange…

---

## [Who understands julia's typeinference in depth?](https://discourse.julialang.org/t/who-understands-julias-typeinference-in-depth/84419)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 1\
**Last updated:** [July 18, 2022, 7:00pm UTC](https://discourse.julialang.org/t/who-understands-julias-typeinference-in-depth/84419 "2022-07-18T19:00:33Z")

</div>

I already opened an issue for some weird typeinference which blocks me optimizing one of my packages. It would be really great if someone with in-depth julia compiler type-inference knowledge can take a look: https://gi…

---

## [New warning msg from 1.8.0-rc3](https://discourse.julialang.org/t/new-warning-msg-from-1-8-0-rc3/84335)

<div class="topic-metadata">

**Author:** [@ctkelley](https://discourse.julialang.org/u/ctkelley)\
**Replies:** 4\
**Last updated:** [July 17, 2022, 10:13am UTC](https://discourse.julialang.org/t/new-warning-msg-from-1-8-0-rc3/84335 "2022-07-17T10:13:58Z")

</div>

I’m getting WARNING: could not import Base.\_rangestyle into ArrayLayouts when I run CI for my package. This is new for 1.8.0-rc3. What does this mean? Is there something I need to do?

---

## [Efficient way to chain a series of \`diff\` calls](https://discourse.julialang.org/t/efficient-way-to-chain-a-series-of-diff-calls/84275)

<div class="topic-metadata">

**Author:** [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Replies:** 11\
**Last updated:** [July 16, 2022, 12:46pm UTC](https://discourse.julialang.org/t/efficient-way-to-chain-a-series-of-diff-calls/84275 "2022-07-16T12:46:26Z")

</div>

Hi, I would like to call the diff function in base a few times in a row to compute n-th differenced data. Of course, I could import Base.diff and write down an extended version of the function with an ad-hoc for-loop to…

---

## [(Efficiently) construct a Dictionary from a Set](https://discourse.julialang.org/t/efficiently-construct-a-dictionary-from-a-set/83896)

<div class="topic-metadata">

**Author:** [@April-Hannah-Lena](https://discourse.julialang.org/u/April-Hannah-Lena)\
**Replies:** 15\
**Last updated:** [July 14, 2022, 11:24am UTC](https://discourse.julialang.org/t/efficiently-construct-a-dictionary-from-a-set/83896 "2022-07-14T11:24:27Z")

</div>

In our package we have some data structures that act as wrappers around Set{Int} to keep track of various index sets. We now want to insert a ‘weight’ for each item in the set, ie construct a Dict{Int,Float64}, and we wa…

---

## [Efficient global parameters](https://discourse.julialang.org/t/efficient-global-parameters/84090)

<div class="topic-metadata">

**Author:** [@Nathaniel](https://discourse.julialang.org/u/Nathaniel)\
**Replies:** 12\
**Last updated:** [July 14, 2022, 7:01am UTC](https://discourse.julialang.org/t/efficient-global-parameters/84090 "2022-07-14T07:01:18Z")

</div>

I’m getting back into Julia after a long time not using it, so this is a fairly basic question. I have a cell in my notebook something like this: parameters = \[ \[1.0, 2,0\], \[3.0, 4.0\], \[5.0, 6.0\], \[7.0, 8.0…

---

## [Improving the performance of a sum over a vector of vectors](https://discourse.julialang.org/t/improving-the-performance-of-a-sum-over-a-vector-of-vectors/84150)

<div class="topic-metadata">

**Author:** [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Replies:** 10\
**Last updated:** [July 13, 2022, 10:36pm UTC](https://discourse.julialang.org/t/improving-the-performance-of-a-sum-over-a-vector-of-vectors/84150 "2022-07-13T22:36:19Z")

</div>

I want to consider the sum over a vector of vectors. Consider the following benchmarks for a problem involving the sum over some data (getting a log-likelihood): using BenchmarkTools, Random, LoopVectorization Random.se…

---

## [Fast Jaccard Distance between sets of strings?](https://discourse.julialang.org/t/fast-jaccard-distance-between-sets-of-strings/84125)

<div class="topic-metadata">

**Author:** [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Replies:** 3\
**Last updated:** [July 13, 2022, 5:11pm UTC](https://discourse.julialang.org/t/fast-jaccard-distance-between-sets-of-strings/84125 "2022-07-13T17:11:33Z")

</div>

My friend needs to compute the jaccard distance between sets of strings. The number of sets is hundreds and the number of strings in each set is thousands. The length of the strings is \<= 20. He has thousands of dataset…

---

## [Performance of value assignment inside functions](https://discourse.julialang.org/t/performance-of-value-assignment-inside-functions/84162)

<div class="topic-metadata">

**Author:** [@NicolasW](https://discourse.julialang.org/u/NicolasW)\
**Replies:** 3\
**Last updated:** [July 13, 2022, 1:20pm UTC](https://discourse.julialang.org/t/performance-of-value-assignment-inside-functions/84162 "2022-07-13T13:20:55Z")

</div>

I am puzzled by the performance of Julia, somehow it matters if I fully specialize the function argument. Consider the two functions: @noinline @inbounds function update\_gen!(y::AbstractVector{T}, x::AbstractVector{T})…

---

## [Using Turing for MCMC estimation](https://discourse.julialang.org/t/using-turing-for-mcmc-estimation/84137)

<div class="topic-metadata">

**Author:** [@Jian\_ZUO](https://discourse.julialang.org/u/Jian_ZUO)\
**Replies:** 4\
**Last updated:** [July 13, 2022, 6:30am UTC](https://discourse.julialang.org/t/using-turing-for-mcmc-estimation/84137 "2022-07-13T06:30:38Z")

</div>

Hi, I am new to Turing PPL. I have a random variable X which is Gamma distributed, i.e., X ~Ga(α, β). And the scale β parameter of X is also obeys a Gamma law, namely, β ~ Ga(α0, β0). Then I want to infer the above par…

---

## [Unwanted allocations when updating type field](https://discourse.julialang.org/t/unwanted-allocations-when-updating-type-field/84122)

<div class="topic-metadata">

**Author:** [@WDM-Computation](https://discourse.julialang.org/u/WDM-Computation)\
**Replies:** 5\
**Last updated:** [July 12, 2022, 8:55pm UTC](https://discourse.julialang.org/t/unwanted-allocations-when-updating-type-field/84122 "2022-07-12T20:55:30Z")

</div>

Hello! Physics PhD student here using Julia for a research project. I have a question regarding what seems to be unnecessary extra memory allocations in my program. I am using a custom type along the lines of abstract…

---

## [Type instability in Folds.map](https://discourse.julialang.org/t/type-instability-in-folds-map/84080)

<div class="topic-metadata">

**Author:** [@MattSainsbury-Dale](https://discourse.julialang.org/u/MattSainsbury-Dale)\
**Replies:** 0\
**Last updated:** [July 12, 2022, 3:54am UTC](https://discourse.julialang.org/t/type-instability-in-folds-map/84080 "2022-07-12T03:54:28Z")

</div>

Hello, I’ve noticed that the Folds version of map() seems to introduce type instability: using Folds f1(K::Integer) = map(identity, 1:K) f2(K::Integer) = Folds.map(identity, 1:K) @code\_warntype f1(5) @code\_warntype f…

---

## [Annotations using Package Gaston](https://discourse.julialang.org/t/annotations-using-package-gaston/84076)

<div class="topic-metadata">

**Author:** [@angeloaliano1](https://discourse.julialang.org/u/angeloaliano1)\
**Replies:** 0\
**Last updated:** [July 11, 2022, 11:46pm UTC](https://discourse.julialang.org/t/annotations-using-package-gaston/84076 "2022-07-11T23:46:41Z")

</div>

Dear all, I have the code to plot a graph using Gaston using Gaston L=\[1 2;3 4\] scatter(L\[1:1,1\], L\[1:1,2\],linewidth="3", pointtype="fsquare", plotstyle="linespoints",Axes(key = :off)) How can I do a annotation at rig…

---

## [Summing an element of tuple](https://discourse.julialang.org/t/summing-an-element-of-tuple/84020)

<div class="topic-metadata">

**Author:** [@Salvatore\_Candita](https://discourse.julialang.org/u/Salvatore_Candita)\
**Replies:** 7\
**Last updated:** [July 11, 2022, 12:08pm UTC](https://discourse.julialang.org/t/summing-an-element-of-tuple/84020 "2022-07-11T12:08:42Z")

</div>

Hi everyone, I’m struggling with the following operation: I have an array of Tuple{Int,String) in which I have to increase by 1 the first element of the tuple but it seems doesn’t work in a while cycle; here the solutio…

---

## [OpenBLAS threads repeatedly call gettimeofday() at the end of a loop](https://discourse.julialang.org/t/openblas-threads-repeatedly-call-gettimeofday-at-the-end-of-a-loop/84027)

<div class="topic-metadata">

**Author:** [@maxwindiff](https://discourse.julialang.org/u/maxwindiff)\
**Replies:** 0\
**Last updated:** [July 11, 2022, 12:52am UTC](https://discourse.julialang.org/t/openblas-threads-repeatedly-call-gettimeofday-at-the-end-of-a-loop/84027 "2022-07-11T00:52:52Z")

</div>

When doing some profiling, I noticed that OpenBLAS threads would make a lot of calls to gettimeofday(), usually at the end of a loop. It happens on both Julia 1.7 and 1.8-rc1. In some of my programs this can add up to 10…

---

## [Performance of recursive function](https://discourse.julialang.org/t/performance-of-recursive-function/83961)

<div class="topic-metadata">

**Author:** [@Fabrice\_Rosay](https://discourse.julialang.org/u/Fabrice_Rosay)\
**Replies:** 12\
**Last updated:** [July 10, 2022, 7:58am UTC](https://discourse.julialang.org/t/performance-of-recursive-function/83961 "2022-07-10T07:58:48Z")

</div>

Hi, I have the following recursive function to calculate the number of positions in a game. All functions inside perft (play, gen\_moves, isOver) are non allocating, yet perft allocates a lot of memory. Using the track…

---

## [Performance optimization on lots of small linear algebra operations](https://discourse.julialang.org/t/performance-optimization-on-lots-of-small-linear-algebra-operations/83850)

<div class="topic-metadata">

**Author:** [@vfonov](https://discourse.julialang.org/u/vfonov)\
**Replies:** 13\
**Last updated:** [July 8, 2022, 9:11pm UTC](https://discourse.julialang.org/t/performance-optimization-on-lots-of-small-linear-algebra-operations/83850 "2022-07-08T21:11:31Z")

</div>

I stumble on a problem with execution speed when I run lots of simple linear algebra operations in a loop, where using general Arrays performs faster then StaticArrays, but still not as fast as a pure C implementation. …

---

## [Efficiently passing a set of constants to a function](https://discourse.julialang.org/t/efficiently-passing-a-set-of-constants-to-a-function/72248)

<div class="topic-metadata">

**Author:** [@bgctw](https://discourse.julialang.org/u/bgctw)\
**Replies:** 21\
**Last updated:** [July 8, 2022, 7:25pm UTC](https://discourse.julialang.org/t/efficiently-passing-a-set-of-constants-to-a-function/72248 "2022-07-08T19:25:15Z")

</div>

I am using physical constants in a function in a package. The access to these constants should be fast, best the compiler could replace the values in the lower-level-code. I can actually achieve this by using global con…

---

## [Why does \`throw\` break type inference?](https://discourse.julialang.org/t/why-does-throw-break-type-inference/83934)

<div class="topic-metadata">

**Author:** [@yiyuezhuo](https://discourse.julialang.org/u/yiyuezhuo)\
**Replies:** 2\
**Last updated:** [July 8, 2022, 9:25am UTC](https://discourse.julialang.org/t/why-does-throw-break-type-inference/83934 "2022-07-08T09:25:01Z")

</div>

I’m researching SSA-IR, and I found that most types of Julia functions are determined by compile-time, as they’re converted to invoke type from call type with a MethodInstance in code\_typed. But there are still some call …

---

## [Type stability in MixtureModels](https://discourse.julialang.org/t/type-stability-in-mixturemodels/83932)

<div class="topic-metadata">

**Author:** [@LeeviL](https://discourse.julialang.org/u/LeeviL)\
**Replies:** 0\
**Last updated:** [July 8, 2022, 7:43am UTC](https://discourse.julialang.org/t/type-stability-in-mixturemodels/83932 "2022-07-08T07:43:36Z")

</div>

Hi! I want to define a MixtureModel in which the component distributions might be from different families. While this piece of code works, the code is type unstable: using Distributions mixture = MixtureModel(\[Normal(-2…

---

## [Bound checking in eachindex(x,y) in 1.7.3](https://discourse.julialang.org/t/bound-checking-in-eachindex-x-y-in-1-7-3/83847)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 2\
**Last updated:** [July 6, 2022, 5:50pm UTC](https://discourse.julialang.org/t/bound-checking-in-eachindex-x-y-in-1-7-3/83847 "2022-07-06T17:50:32Z")

</div>

I noticed now that in 1.7.3 a code like this does not skip bounds checking: julia\> function f!(x,y) for i in eachindex(x,y) x\[i\] = x\[i\] + y\[i\] end end f! (generic function wit…

---

## [Exponentiation with literals in both base and exponent not removed by compiler in 1.8](https://discourse.julialang.org/t/exponentiation-with-literals-in-both-base-and-exponent-not-removed-by-compiler-in-1-8/83834)

<div class="topic-metadata">

**Author:** [@albheim](https://discourse.julialang.org/u/albheim)\
**Replies:** 10\
**Last updated:** [July 6, 2022, 3:59pm UTC](https://discourse.julialang.org/t/exponentiation-with-literals-in-both-base-and-exponent-not-removed-by-compiler-in-1-8/83834 "2022-07-06T15:59:31Z")

</div>

Between 1.7.3 and 1.8.0-rc1 it seems like the compiler stopped calculating exponentiation Float64^Int literals (maybe other to, haven’t checked) if the exponent is larger than 3. This resulted in adding an overhead for v…

---

## [Order of operations matrix multiplications](https://discourse.julialang.org/t/order-of-operations-matrix-multiplications/83770)

<div class="topic-metadata">

**Author:** [@Rasmus\_Hoier](https://discourse.julialang.org/u/Rasmus_Hoier)\
**Replies:** 5\
**Last updated:** [July 5, 2022, 2:10pm UTC](https://discourse.julialang.org/t/order-of-operations-matrix-multiplications/83770 "2022-07-05T14:10:31Z")

</div>

I know that in MATLAB the default order of operations is left to right, so it can be very useful to use parenthesis to specify the optimal order of matrix multiplications. I was surprised to see that Julia seems to figur…

---

## [Hard to beat Numba / JAX loop for generating Mandelbrot](https://discourse.julialang.org/t/hard-to-beat-numba-jax-loop-for-generating-mandelbrot/82725)

<div class="topic-metadata">

**Author:** [@jling](https://discourse.julialang.org/u/jling)\
**Replies:** 61\
**Last updated:** [June 30, 2022, 4:03am UTC](https://discourse.julialang.org/t/hard-to-beat-numba-jax-loop-for-generating-mandelbrot/82725 "2022-06-30T04:03:53Z")

</div>

find the numba code in: mandelbrot-on-all-accelerators.ipynb · GitHub under title “Numba: imperative in a compiled subset of Python”, on my laptop, the numba code reports: In \[30\]: %%timeit ...: run\_numba(2000, 3000…

---

## [Interpreting \`JET\` warnings on a simple \`Polyester\` multithreaded loop](https://discourse.julialang.org/t/interpreting-jet-warnings-on-a-simple-polyester-multithreaded-loop/83681)

<div class="topic-metadata">

**Author:** [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Replies:** 7\
**Last updated:** [July 4, 2022, 3:12am UTC](https://discourse.julialang.org/t/interpreting-jet-warnings-on-a-simple-polyester-multithreaded-loop/83681 "2022-07-04T03:12:23Z")

</div>

Polyester seems to be one of the bigger sources of TTFX in some of my libraries. It is similarly the main source of warnings when using JET. Below is a very simple multi-threaded loop that causes a large number of JET wa…

---

## [Vectorized statistics.jl](https://discourse.julialang.org/t/vectorized-statistics-jl/83506)

<div class="topic-metadata">

**Author:** [@djholiver](https://discourse.julialang.org/u/djholiver)\
**Replies:** 3\
**Last updated:** [July 3, 2022, 7:36pm UTC](https://discourse.julialang.org/t/vectorized-statistics-jl/83506 "2022-07-03T19:36:46Z")

</div>

Hi, I came across VectorizedStatistics.jl but cant see it mentioned in package announcements (although it’s available in the general registry). It appears to be an absolutely incredible leap in performance (for some use…

---

## [In-place svd?](https://discourse.julialang.org/t/in-place-svd/60567)

<div class="topic-metadata">

**Author:** [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Replies:** 16\
**Last updated:** [July 2, 2022, 1:19pm UTC](https://discourse.julialang.org/t/in-place-svd/60567 "2022-07-02T13:19:07Z")

</div>

I need to do SVD many many times, so I wanna have a in-place version of svd(). What I mean by “in-place” is like: svd!(U, S, V, A) which works out the svd of A and writes the output matrices into the pre-allocated U, S…

---

## [Underperformant mapreduce](https://discourse.julialang.org/t/underperformant-mapreduce/83624)

<div class="topic-metadata">

**Author:** [@nandoconde](https://discourse.julialang.org/u/nandoconde)\
**Replies:** 0\
**Last updated:** [July 1, 2022, 2:10pm UTC](https://discourse.julialang.org/t/underperformant-mapreduce/83624 "2022-07-01T14:10:29Z")

</div>

Conceptually, shouldn’t the mapreduce version be faster than the reduce version? Granted, the difference is not much, but there are consistently some nanoseconds missing. julia\> N = 5115; julia\> a1 = rand(Bool, N); j…

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

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