# Performance

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

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

**Page:** 49

---

## [Documenter.jl; Documentation workflow run failed for main branch ERROR in GitHub](https://discourse.julialang.org/t/documenter-jl-documentation-workflow-run-failed-for-main-branch-error-in-github/94744)

<div class="topic-metadata">

**Author:** [@mdogan](https://discourse.julialang.org/u/mdogan)\
**Replies:** 2\
**Last updated:** [February 17, 2023, 8:21am UTC](https://discourse.julialang.org/t/documenter-jl-documentation-workflow-run-failed-for-main-branch-error-in-github/94744 "2023-02-17T08:21:56Z")

</div>

Following the “Documenter.jl” documentation I pushed documetation.yml file to GitHub. For some reason receiving the below error. Could you please help me with that? Run julia --project=docs/ -e 'using Pkg; Pkg.develop(P…

---

## [Searching unicode characters in Visual Studio Code](https://discourse.julialang.org/t/searching-unicode-characters-in-visual-studio-code/94722)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 1\
**Last updated:** [February 16, 2023, 1:42pm UTC](https://discourse.julialang.org/t/searching-unicode-characters-in-visual-studio-code/94722 "2023-02-16T13:42:27Z")

</div>

I love Julia and Visual Studio Code (VSC), and I have adopted Unicode characters such as \\omega\[tab\]. However, how do I search for those characters using VSC? I have not figured this out or found any information that all…

---

## [How to speed up value updating in an array?](https://discourse.julialang.org/t/how-to-speed-up-value-updating-in-an-array/94650)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 19\
**Last updated:** [February 15, 2023, 9:56pm UTC](https://discourse.julialang.org/t/how-to-speed-up-value-updating-in-an-array/94650 "2023-02-15T21:56:55Z")

</div>

Hello! I am running a code I wrote to find the nearest neighbours between some points. Benchmarking my current version of the code and using @profview I found that what is taking the longest time now, is not computation…

---

## [High performance data structure for use in image modelling](https://discourse.julialang.org/t/high-performance-data-structure-for-use-in-image-modelling/94621)

<div class="topic-metadata">

**Author:** [@evanderveer](https://discourse.julialang.org/u/evanderveer)\
**Replies:** 2\
**Last updated:** [February 15, 2023, 9:33pm UTC](https://discourse.julialang.org/t/high-performance-data-structure-for-use-in-image-modelling/94621 "2023-02-15T21:33:02Z")

</div>

Hi there, I am writing some code which fits a model consisting of two-dimensional gaussian functions to an image. At the moment, I am using a mutable struct which holds the information about the model as well as a vecto…

---

## [Is there a smarter way to evaluate an float power?](https://discourse.julialang.org/t/is-there-a-smarter-way-to-evaluate-an-float-power/93330)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 27\
**Last updated:** [February 15, 2023, 5:00pm UTC](https://discourse.julialang.org/t/is-there-a-smarter-way-to-evaluate-an-float-power/93330 "2023-02-15T17:00:18Z")

</div>

Hello! Suppose I have this expression: V = rand(10^5) G = 1/7 @benchmark $V .^ $G BenchmarkTools.Trial: 1871 samples with 1 evaluation. Range (min … max): 2.282 ms … 7.797 ms ┊ GC (min … max): 0.00% … 65.35% Tim…

---

## [How to efficiently multiply every matrix in a vector of matrices by another vector?](https://discourse.julialang.org/t/how-to-efficiently-multiply-every-matrix-in-a-vector-of-matrices-by-another-vector/94661)

<div class="topic-metadata">

**Author:** [@Yolo\_Tolo](https://discourse.julialang.org/u/Yolo_Tolo)\
**Replies:** 3\
**Last updated:** [February 15, 2023, 4:05pm UTC](https://discourse.julialang.org/t/how-to-efficiently-multiply-every-matrix-in-a-vector-of-matrices-by-another-vector/94661 "2023-02-15T16:05:42Z")

</div>

I have a vector of matrices t and another vector v: t = \[rand(10, 10) for \_ in 1:3\] v = rand(10) I want to multiply every matrix in t by v. I do it like this: res = \[t\_i \* v for t\_i in t\] but it’s executed slowly (an…

---

## [Why does this broadcast operation require specialization for optimal performance?](https://discourse.julialang.org/t/why-does-this-broadcast-operation-require-specialization-for-optimal-performance/94547)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 7\
**Last updated:** [February 15, 2023, 3:08pm UTC](https://discourse.julialang.org/t/why-does-this-broadcast-operation-require-specialization-for-optimal-performance/94547 "2023-02-15T15:08:00Z")

</div>

julia\> g1(f, x, y, z) = (y .= f.(x, z); y); julia\> g2(f, x, y, z) = (broadcast!(f, y, x, z); y); julia\> g3(f::F, x, y, z) where {F} = (y .= f.(x, z); y); julia\> x = rand(100); y = zeros(100); z = rand(100); julia\> @b…

---

## [Function types unexpectedly equal](https://discourse.julialang.org/t/function-types-unexpectedly-equal/94674)

<div class="topic-metadata">

**Author:** [@fph](https://discourse.julialang.org/u/fph)\
**Replies:** 5\
**Last updated:** [February 15, 2023, 10:42am UTC](https://discourse.julialang.org/t/function-types-unexpectedly-equal/94674 "2023-02-15T10:42:20Z")

</div>

julia\> T = \[x-\>x\*k for k in 1:3\] 3-element Vector{var"#54#56"{Int64}}: #54 (generic function with 1 method) #54 (generic function with 1 method) #54 (generic function with 1 method) The three functions in the array a…

---

## [Why don't operations on strings constant-fold?](https://discourse.julialang.org/t/why-dont-operations-on-strings-constant-fold/94597)

<div class="topic-metadata">

**Author:** [@uniment](https://discourse.julialang.org/u/uniment)\
**Replies:** 9\
**Last updated:** [February 14, 2023, 11:22pm UTC](https://discourse.julialang.org/t/why-dont-operations-on-strings-constant-fold/94597 "2023-02-14T23:22:23Z")

</div>

Why doesn’t bar constant-fold, although foo does? julia\> using BenchmarkTools julia\> foo(::Type{T}) where T = parse(T, '3') bar(::Type{T}) where T = parse(T, "3"); julia\> @btime foo(Int) @btime bar(Int);…

---

## [IfElse doesn't work properly when using @turbo](https://discourse.julialang.org/t/ifelse-doesnt-work-properly-when-using-turbo/94639)

<div class="topic-metadata">

**Author:** [@Zentrik](https://discourse.julialang.org/u/Zentrik)\
**Replies:** 3\
**Last updated:** [February 14, 2023, 11:08pm UTC](https://discourse.julialang.org/t/ifelse-doesnt-work-properly-when-using-turbo/94639 "2023-02-14T23:08:53Z")

</div>

function iftest(x) bestIndex = 0 minValue = Inf @turbo for i in eachindex(x) bestIndex = ifelse(x\[i\] \< minValue, i, bestIndex) minValue = min(x\[i\], minValue) end return minValue, bestI…

---

## [Function Composition Strategies](https://discourse.julialang.org/t/function-composition-strategies/94571)

<div class="topic-metadata">

**Author:** [@mrufsvold](https://discourse.julialang.org/u/mrufsvold)\
**Replies:** 5\
**Last updated:** [February 14, 2023, 11:02am UTC](https://discourse.julialang.org/t/function-composition-strategies/94571 "2023-02-14T11:02:05Z")

</div>

In my project ExpandNestedData.jl, I need to compose a series of Iterator functions that are unique for any given input. I was using Iterators.repeat, Iterators.flatten, etc. but since each of these returns a parametrize…

---

## [Why can't the compiler constant-fold operations on BigInt and BigFloat?](https://discourse.julialang.org/t/why-cant-the-compiler-constant-fold-operations-on-bigint-and-bigfloat/94447)

<div class="topic-metadata">

**Author:** [@bobcassels](https://discourse.julialang.org/u/bobcassels)\
**Replies:** 14\
**Last updated:** [February 13, 2023, 1:44am UTC](https://discourse.julialang.org/t/why-cant-the-compiler-constant-fold-operations-on-bigint-and-bigfloat/94447 "2023-02-13T01:44:49Z")

</div>

wtf(x) = x \* Float64(big(12.34) / big(180)^3) @code\_llvm wtf(1.0) shows runtime calls to do the big-ifying, and the exponentiation. If I remove the calls to big, it constant-folds just fine.

---

## [Do we have a "sizeforce!"?](https://discourse.julialang.org/t/do-we-have-a-sizeforce/94496)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 2\
**Last updated:** [February 12, 2023, 8:59am UTC](https://discourse.julialang.org/t/do-we-have-a-sizeforce/94496 "2023-02-12T08:59:26Z")

</div>

Hello! Reading in the help of sizehint!: I notice how it is only a “suggestive” procedure and that it may do it. Is there a way to force it? I know I can preallocate arrays my self. For less code complexity, I had …

---

## [Type stability issues when broadcasting](https://discourse.julialang.org/t/type-stability-issues-when-broadcasting/92715)

<div class="topic-metadata">

**Author:** [@jpdoane](https://discourse.julialang.org/u/jpdoane)\
**Replies:** 4\
**Last updated:** [February 12, 2023, 8:39am UTC](https://discourse.julialang.org/t/type-stability-issues-when-broadcasting/92715 "2023-02-12T08:39:09Z")

</div>

I am seeing some odd type instability issues when broadcasting. Simple functions seem to become type-unstable when broadcasting over multiple views: f1(x::AbstractVector{T}) where T = 1 f2(x::AbstractVector{T}) where T…

---

## [What causes this performance loss when using value types?](https://discourse.julialang.org/t/what-causes-this-performance-loss-when-using-value-types/94065)

<div class="topic-metadata">

**Author:** [@akrishnamoorthy](https://discourse.julialang.org/u/akrishnamoorthy)\
**Replies:** 3\
**Last updated:** [February 10, 2023, 11:50pm UTC](https://discourse.julialang.org/t/what-causes-this-performance-loss-when-using-value-types/94065 "2023-02-10T23:50:42Z")

</div>

The following are two implementations of the factorial function: fact1(n) = fact1(Val(n)) fact1(::Val{n}) where {n} = n\*fact1(Val(n-1)) fact1(::Val{1}) = 1 and fact2(n) = n==1 ? 1 : n\*fact2(n-1) This may be subjectiv…

---

## [Vectorization heuristics are hard! Is there a way to ask/get more information to/from the compiler/LLVM about loop vectorization](https://discourse.julialang.org/t/vectorization-heuristics-are-hard-is-there-a-way-to-ask-get-more-information-to-from-the-compiler-llvm-about-loop-vectorization/94432)

<div class="topic-metadata">

**Author:** [@ndinsmore](https://discourse.julialang.org/u/ndinsmore)\
**Replies:** 2\
**Last updated:** [February 10, 2023, 10:11pm UTC](https://discourse.julialang.org/t/vectorization-heuristics-are-hard-is-there-a-way-to-ask-get-more-information-to-from-the-compiler-llvm-about-loop-vectorization/94432 "2023-02-10T22:11:21Z")

</div>

In the PR below, we have made a lot of progress speeding up isascii with something as simple as essentially: (which is faster than using UInt64) function \_isascii(cu::AbstractVector{CU}, first, last) where {CU} r = …

---

## [MethodError: Convert Ref value between GPU and CPU](https://discourse.julialang.org/t/methoderror-convert-ref-value-between-gpu-and-cpu/94426)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 0\
**Last updated:** [February 10, 2023, 7:07pm UTC](https://discourse.julialang.org/t/methoderror-convert-ref-value-between-gpu-and-cpu/94426 "2023-02-10T19:07:45Z")

</div>

Can anyone teach me how to overload the convert function to remove this error, using CUDA? MethodError: Cannot \`convert\` an object of type CUDA.CuRefValue{Int64} to an object of type Base.RefValue{Int64} Kind regards

---

## [Two separate vectors of same length and eliminating items in both vectors, whenever the values of those vectors are the same at identical columns. Depending on this the values of a third vector shall be eliminated accordingly](https://discourse.julialang.org/t/two-separate-vectors-of-same-length-and-eliminating-items-in-both-vectors-whenever-the-values-of-those-vectors-are-the-same-at-identical-columns-depending-on-this-the-values-of-a-third-vector-shall-be-eliminated-accordingly/94371)

<div class="topic-metadata">

**Author:** [@ratwolf](https://discourse.julialang.org/u/ratwolf)\
**Replies:** 1\
**Last updated:** [February 9, 2023, 7:35pm UTC](https://discourse.julialang.org/t/two-separate-vectors-of-same-length-and-eliminating-items-in-both-vectors-whenever-the-values-of-those-vectors-are-the-same-at-identical-columns-depending-on-this-the-values-of-a-third-vector-shall-be-eliminated-accordingly/94371 "2023-02-09T19:35:24Z")

</div>

Two separate vectors of same length (but the lenghth can vary and is not predictable) and eliminating items in both vectors, whenever the values of those vectors are the same at identical columns. Depending on this the v…

---

## [CatViews for CUDA.jl?](https://discourse.julialang.org/t/catviews-for-cuda-jl/94304)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 12\
**Last updated:** [February 10, 2023, 6:06pm UTC](https://discourse.julialang.org/t/catviews-for-cuda-jl/94304 "2023-02-10T18:06:03Z")

</div>

Hello! I found a bit of an old package, but with a great feature I want to have so much in my code. It would let me keep current code structure and give me the flexibility I need. The package is: With the example pro…

---

## [OrdinaryDiffEq Loading Time](https://discourse.julialang.org/t/ordinarydiffeq-loading-time/94386)

<div class="topic-metadata">

**Author:** [@pranavkrishna](https://discourse.julialang.org/u/pranavkrishna)\
**Replies:** 11\
**Last updated:** [February 10, 2023, 5:58pm UTC](https://discourse.julialang.org/t/ordinarydiffeq-loading-time/94386 "2023-02-10T17:58:08Z")

</div>

I am wondering if it is usual for it to take ~30 seconds to load the OrdinaryDiffEq package. I am curious why there is so much recompilation when loading the package. Is there something I could do to reduce the load time…

---

## [Improving the speed of large population simulations in DifferentialEquations.jl](https://discourse.julialang.org/t/improving-the-speed-of-large-population-simulations-in-differentialequations-jl/93109)

<div class="topic-metadata">

**Author:** [@freddie090](https://discourse.julialang.org/u/freddie090)\
**Replies:** 10\
**Last updated:** [February 9, 2023, 6:48pm UTC](https://discourse.julialang.org/t/improving-the-speed-of-large-population-simulations-in-differentialequations-jl/93109 "2023-02-09T18:48:23Z")

</div>

Hi, Apologies if this isn’t the correct forum for this style of question, but I think it could be viewed as a performance problem. Sensitive/Resistant Birth Death Simulation I have a birth-death simulation I am runnin…

---

## [In-place inverse permutation](https://discourse.julialang.org/t/in-place-inverse-permutation/94368)

<div class="topic-metadata">

**Author:** [@jacob-roth](https://discourse.julialang.org/u/jacob-roth)\
**Replies:** 1\
**Last updated:** [February 9, 2023, 6:16pm UTC](https://discourse.julialang.org/t/in-place-inverse-permutation/94368 "2023-02-09T18:16:46Z")

</div>

Is there a reason that there is not an in-place equivalent of sortperm!, i.e., “invperm!”? One current (v1.8.3) approach would be to call invpermute!(v, sig) for permutation sig, but the docs say that for v with many el…

---

## [Tying a function to an array when I get the value of the array](https://discourse.julialang.org/t/tying-a-function-to-an-array-when-i-get-the-value-of-the-array/94354)

<div class="topic-metadata">

**Author:** [@LolianSh](https://discourse.julialang.org/u/LolianSh)\
**Replies:** 4\
**Last updated:** [February 9, 2023, 6:00pm UTC](https://discourse.julialang.org/t/tying-a-function-to-an-array-when-i-get-the-value-of-the-array/94354 "2023-02-09T18:00:28Z")

</div>

Hi everyone, I have question. Maybe someone has encountered this before and can help me out. I would like to do the following: searchsortedfirst(ntoh.(v), x) Assuming v is a memory mapped vector on disk. Using ntoh.(…

---

## [Matrix Multiplication of a Large Number of Small Matrices](https://discourse.julialang.org/t/matrix-multiplication-of-a-large-number-of-small-matrices/93531)

<div class="topic-metadata">

**Author:** [@andrewkhardy](https://discourse.julialang.org/u/andrewkhardy)\
**Replies:** 12\
**Last updated:** [February 8, 2023, 7:47pm UTC](https://discourse.julialang.org/t/matrix-multiplication-of-a-large-number-of-small-matrices/93531 "2023-02-08T19:47:04Z")

</div>

Im interested in computing the matrix multiplication of 2x2 matrices, but these are sampled at a very large number of points. Here is my current benchmark using Tullio,TensorCast, LinearAlgebra, StaticArrays function M…

---

## [FinancialToolbox unsupported keyword argument "FlagIsCall"](https://discourse.julialang.org/t/financialtoolbox-unsupported-keyword-argument-flagiscall/94151)

<div class="topic-metadata">

**Author:** [@compleat](https://discourse.julialang.org/u/compleat)\
**Replies:** 2\
**Last updated:** [February 7, 2023, 9:40pm UTC](https://discourse.julialang.org/t/financialtoolbox-unsupported-keyword-argument-flagiscall/94151 "2023-02-07T21:40:38Z")

</div>

Trying to get the FinancialToolbox working as per documentation. If I try to compute a Put Option value as follows I get an error: blsprice(10,10-2.04,.01,1,.1,FlagIsCall=false) results in errors the most relevant her…

---

## [CartesianIndices performance: 3D faster than 2D?](https://discourse.julialang.org/t/cartesianindices-performance-3d-faster-than-2d/94110)

<div class="topic-metadata">

**Author:** [@lntricate](https://discourse.julialang.org/u/lntricate)\
**Replies:** 2\
**Last updated:** [February 6, 2023, 8:16pm UTC](https://discourse.julialang.org/t/cartesianindices-performance-3d-faster-than-2d/94110 "2023-02-06T20:16:52Z")

</div>

I have encountered a strange occurence when testing the performance of CartesianIndices: using BenchmarkTools function test(t::Tuple) for \_ ∈ CartesianIndices(t) end end @btime test((100,)) # 3.094 ns @btime test(…

---

## [Type Stability Help](https://discourse.julialang.org/t/type-stability-help/94114)

<div class="topic-metadata">

**Author:** [@fft](https://discourse.julialang.org/u/fft)\
**Replies:** 5\
**Last updated:** [February 6, 2023, 3:18am UTC](https://discourse.julialang.org/t/type-stability-help/94114 "2023-02-06T03:18:44Z")

</div>

I am following along with Make Your Own Neural Network by Tariq Rashid. In this work you implement a small neural network by hand. This is for my own benefit and I know if I was doing something for real I should just Flu…

---

## [Finding low frequency numbers in a large collection](https://discourse.julialang.org/t/finding-low-frequency-numbers-in-a-large-collection/93556)

<div class="topic-metadata">

**Author:** [@CodeGodz](https://discourse.julialang.org/u/CodeGodz)\
**Replies:** 20\
**Last updated:** [February 3, 2023, 8:21pm UTC](https://discourse.julialang.org/t/finding-low-frequency-numbers-in-a-large-collection/93556 "2023-02-03T20:21:18Z")

</div>

Hey all :slight\_smile: See edit here for clarification I want to find all numbers in a file that have a frequency \<=100. The numbers are in the UInt32 range so I could allocate a Vector{UInt8}(typemax(UInt32)) to coun…

---

## [My generated Julia function from a niche DSL language takes 4min to compile](https://discourse.julialang.org/t/my-generated-julia-function-from-a-niche-dsl-language-takes-4min-to-compile/93974)

<div class="topic-metadata">

**Author:** [@heetbeet](https://discourse.julialang.org/u/heetbeet)\
**Replies:** 8\
**Last updated:** [February 3, 2023, 9:08pm UTC](https://discourse.julialang.org/t/my-generated-julia-function-from-a-niche-dsl-language-takes-4min-to-compile/93974 "2023-02-03T21:08:08Z")

</div>

I have an application that generates Julia code from a niche DSL language. The generated code is correct and returns the same results as the DSL interpreter. One problem, though, is that for a real-world application, the…

---

## [Possible Performance Regression for Loops on 1.9?](https://discourse.julialang.org/t/possible-performance-regression-for-loops-on-1-9/93994)

<div class="topic-metadata">

**Author:** [@jacobxk](https://discourse.julialang.org/u/jacobxk)\
**Replies:** 12\
**Last updated:** [February 3, 2023, 6:23pm UTC](https://discourse.julialang.org/t/possible-performance-regression-for-loops-on-1-9/93994 "2023-02-03T18:23:02Z")

</div>

There is a function in Bogumił Kamiński’s book Julia for Data Analysis(page 7) with the purpose to show off the optimizations done by Julia compiler. function sum\_n(n) s = 0 for i in 1:n s += i end …

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

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