# Performance

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

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

**Page:** 78

---

## [Fast evaluation of multivariate integrals in Julia for integrands depending on many parameters](https://discourse.julialang.org/t/fast-evaluation-of-multivariate-integrals-in-julia-for-integrands-depending-on-many-parameters/71815)

<div class="topic-metadata">

**Author:** [@vicdolean](https://discourse.julialang.org/u/vicdolean)\
**Replies:** 4\
**Last updated:** [November 20, 2021, 3:02pm UTC](https://discourse.julialang.org/t/fast-evaluation-of-multivariate-integrals-in-julia-for-integrands-depending-on-many-parameters/71815 "2021-11-20T15:02:35Z")

</div>

Hi, I need to evaluate an oscillatory integral of the form \\int\_D f(x) exp(\\omega g(x)) dx on a two dimensional domain D that could be R^2, given than f(x) is a exponentially decreasing function equal to an exponentia…

---

## [How to change the tolerance of the QRPivoted method](https://discourse.julialang.org/t/how-to-change-the-tolerance-of-the-qrpivoted-method/71753)

<div class="topic-metadata">

**Author:** [@valperez](https://discourse.julialang.org/u/valperez)\
**Replies:** 5\
**Last updated:** [November 19, 2021, 6:08pm UTC](https://discourse.julialang.org/t/how-to-change-the-tolerance-of-the-qrpivoted-method/71753 "2021-11-19T18:08:19Z")

</div>

Hi there :slight\_smile: I’m using the LinearAlgebra package in Julia to use the QRPivoted method. The documentation is not very clear about the use of the tolerance. I want to use que qr pivoted function on a matrix A b…

---

## [Different behavior for same \`@code\_llvm\` for voxel traversal](https://discourse.julialang.org/t/different-behavior-for-same-code-llvm-for-voxel-traversal/71695)

<div class="topic-metadata">

**Author:** [@goretkin](https://discourse.julialang.org/u/goretkin)\
**Replies:** 14\
**Last updated:** [November 20, 2021, 12:33am UTC](https://discourse.julialang.org/t/different-behavior-for-same-code-llvm-for-voxel-traversal/71695 "2021-11-20T00:33:51Z")

</div>

I have a function that takes in a line segment. I wanted to benchmark the performance and see if there is a difference whether the line segment is specified with endpoints given in integers or floats. The function has an…

---

## [Does Julia detect the maximum number of threads availible and if so how?](https://discourse.julialang.org/t/does-julia-detect-the-maximum-number-of-threads-availible-and-if-so-how/71683)

<div class="topic-metadata">

**Author:** [@anon69491625](https://discourse.julialang.org/u/anon69491625)\
**Replies:** 29\
**Last updated:** [November 19, 2021, 6:27pm UTC](https://discourse.julialang.org/t/does-julia-detect-the-maximum-number-of-threads-availible-and-if-so-how/71683 "2021-11-19T18:27:50Z")

</div>

New to julia and experimenting with threads. I can’t seem to figure out how Julia determines JULIA\_NUM\_THREADS I have two Intel xeon 2699 v3 in my hp z840 Intel blurb on 2699 v3 So what should JULIA\_NUM\_THREADS end…

---

## [Benchmarking MPI programs?](https://discourse.julialang.org/t/benchmarking-mpi-programs/71775)

<div class="topic-metadata">

**Author:** [@johnomotani](https://discourse.julialang.org/u/johnomotani)\
**Replies:** 3\
**Last updated:** [November 19, 2021, 6:00pm UTC](https://discourse.julialang.org/t/benchmarking-mpi-programs/71775 "2021-11-19T18:00:00Z")

</div>

Has anyone tried to get BenchmarkTools.jl to play nicely with MPI? I’ve been struggling with intermittent hangs\*. It seems without thinking too hard like it should be possible to make @benchmark MPI-aware pretty easily (…

---

## [No method matching loop\_einsum](https://discourse.julialang.org/t/no-method-matching-loop-einsum/71638)

<div class="topic-metadata">

**Author:** [@F-YF](https://discourse.julialang.org/u/F-YF)\
**Replies:** 1\
**Last updated:** [November 19, 2021, 10:58am UTC](https://discourse.julialang.org/t/no-method-matching-loop-einsum/71638 "2021-11-19T10:58:54Z")

</div>

How to deal with this when I used the Optim.jl and Zygote.jl packages for optimization, that the function used OMEinsum.jl. ERROR: LoadError: MethodError: no method matching loop\_einsum(::EinCode{((), (2, 1, 3)),(1, 2…

---

## [Sorting a vector of fixed size](https://discourse.julialang.org/t/sorting-a-vector-of-fixed-size/71766)

<div class="topic-metadata">

**Author:** [@AdamR](https://discourse.julialang.org/u/AdamR)\
**Replies:** 5\
**Last updated:** [November 19, 2021, 10:25am UTC](https://discourse.julialang.org/t/sorting-a-vector-of-fixed-size/71766 "2021-11-19T10:25:17Z")

</div>

I need to solve a combinatorics problem, that requires, among others, finding and sortperm (a.k.a. argsort) for thousands of millions of vectors of fixed size. It so happens that the size of the vector is known at the c…

---

## [Micro benchmarks of kron for vectors](https://discourse.julialang.org/t/micro-benchmarks-of-kron-for-vectors/71689)

<div class="topic-metadata">

**Author:** [@goerch](https://discourse.julialang.org/u/goerch)\
**Replies:** 6\
**Last updated:** [November 18, 2021, 12:05pm UTC](https://discourse.julialang.org/t/micro-benchmarks-of-kron-for-vectors/71689 "2021-11-18T12:05:03Z")

</div>

Edit: corrected according to @jling \`s comment Inspired by another thread here is a micro benchmark of Base.kron for Vector using LinearAlgebra using BenchmarkTools function \_kron(A::Matrix, B::Matrix) C = zeros(s…

---

## [Recommended way to use something like \`evalpoly\` with \`@turbo\` from LoopVectorization.jl](https://discourse.julialang.org/t/recommended-way-to-use-something-like-evalpoly-with-turbo-from-loopvectorization-jl/71706)

<div class="topic-metadata">

**Author:** [@ranocha](https://discourse.julialang.org/u/ranocha)\
**Replies:** 2\
**Last updated:** [November 18, 2021, 11:31am UTC](https://discourse.julialang.org/t/recommended-way-to-use-something-like-evalpoly-with-turbo-from-loopvectorization-jl/71706 "2021-11-18T11:31:00Z")

</div>

What is the recommended way to evaluate polynomials inside loops annotated by @turbo from LoopVectorization.jl? Apparently, neither @evalpoly nor evalpoly work directly. julia\> using LoopVectorization julia\> function f…

---

## [Allocation during access to "typed" field of mutable struct](https://discourse.julialang.org/t/allocation-during-access-to-typed-field-of-mutable-struct/56201)

<div class="topic-metadata">

**Author:** [@Dilchatto](https://discourse.julialang.org/u/Dilchatto)\
**Replies:** 11\
**Last updated:** [November 18, 2021, 11:16am UTC](https://discourse.julialang.org/t/allocation-during-access-to-typed-field-of-mutable-struct/56201 "2021-11-18T11:16:01Z")

</div>

I have following struct mutable struct Element{T\<:AbstractElement} \<: AbstractElement input::StringBuffer name::UnitRange{Int64} attributes::Union{Nothing, Attribute} value::Union{T, Nothing} parent:…

---

## [Apple silicon full power](https://discourse.julialang.org/t/apple-silicon-full-power/70662)

<div class="topic-metadata">

**Author:** [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Replies:** 19\
**Last updated:** [November 18, 2021, 9:13am UTC](https://discourse.julialang.org/t/apple-silicon-full-power/70662 "2021-11-18T09:13:59Z")

</div>

First of all, I would like to thank for the efforts put in v1.7 that supports Apple silicon CPU :100: :bowing\_man: Just two years or so earlier, no body understands why Apple going away from standard GPU libraries like …

---

## [Paradox of normalizing the biggest eigenvalue module to one](https://discourse.julialang.org/t/paradox-of-normalizing-the-biggest-eigenvalue-module-to-one/71664)

<div class="topic-metadata">

**Author:** [@ZhiyuanYao](https://discourse.julialang.org/u/ZhiyuanYao)\
**Replies:** 5\
**Last updated:** [November 18, 2021, 7:01am UTC](https://discourse.julialang.org/t/paradox-of-normalizing-the-biggest-eigenvalue-module-to-one/71664 "2021-11-18T07:01:00Z")

</div>

I run into an interesting but nasty problem in normalizing a matrix so that the largest eigenvalue module is one. The λ in convertMPS\_PBC2OBC should print one, but I got values slightly different from one. The minimum c…

---

## [Function speed up, reduce allocations](https://discourse.julialang.org/t/function-speed-up-reduce-allocations/71647)

<div class="topic-metadata">

**Author:** [@david.brust](https://discourse.julialang.org/u/david.brust)\
**Replies:** 12\
**Last updated:** [November 17, 2021, 8:27pm UTC](https://discourse.julialang.org/t/function-speed-up-reduce-allocations/71647 "2021-11-17T20:27:53Z")

</div>

Hi, I am working on a combinatorial problem called Block Design: Block design - Wikipedia ( specifically Pairwise balanced uniform designs (2-designs or BIBDs) ) I try to group N=25 samples (e.g. integers 1:25) into “…

---

## [Sorting multidimensional arrays](https://discourse.julialang.org/t/sorting-multidimensional-arrays/71657)

<div class="topic-metadata">

**Author:** [@rolim.gustavo](https://discourse.julialang.org/u/rolim.gustavo)\
**Replies:** 3\
**Last updated:** [November 17, 2021, 3:45pm UTC](https://discourse.julialang.org/t/sorting-multidimensional-arrays/71657 "2021-11-17T15:45:48Z")

</div>

Hi, I am currently working on a scheduling problem which has a solution represented by a multidimensional array called Sol. For instance, Sol = \[\[4, 1, 5, 2\], \[3, 6, 10, 9, 7, 8\]\]. Each row is represented by a permutat…

---

## [2D nested loop gives big performance hit in interpolation routine while it should not](https://discourse.julialang.org/t/2d-nested-loop-gives-big-performance-hit-in-interpolation-routine-while-it-should-not/71651)

<div class="topic-metadata">

**Author:** [@Chiil](https://discourse.julialang.org/u/Chiil)\
**Replies:** 2\
**Last updated:** [November 17, 2021, 12:29pm UTC](https://discourse.julialang.org/t/2d-nested-loop-gives-big-performance-hit-in-interpolation-routine-while-it-should-not/71651 "2021-11-17T12:29:22Z")

</div>

I have written a macro that generates fast trilinear interpolation functions for 2x2x2 upsampling with threading. The code runs fine and is on average an order of magnitude faster than Interpolations.jl (which I probably…

---

## [How to implement an efficient Readers-Writer lock?](https://discourse.julialang.org/t/how-to-implement-an-efficient-readers-writer-lock/27446)

<div class="topic-metadata">

**Author:** [@findmyway](https://discourse.julialang.org/u/findmyway)\
**Replies:** 6\
**Last updated:** [November 17, 2021, 12:14am UTC](https://discourse.julialang.org/t/how-to-implement-an-efficient-readers-writer-lock/27446 "2021-11-17T00:14:43Z")

</div>

I read a blog about Readers-Writer Lock here Implementing reader-writer locks last week. The original code was written in Golang. And I attempted to rewrite the code in Julia. The reader count based implementation is st…

---

## [Strategies for parallelization of fast non-uniform tasks](https://discourse.julialang.org/t/strategies-for-parallelization-of-fast-non-uniform-tasks/71531)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 12\
**Last updated:** [November 16, 2021, 11:11pm UTC](https://discourse.julialang.org/t/strategies-for-parallelization-of-fast-non-uniform-tasks/71531 "2021-11-16T23:11:50Z")

</div>

Which are the recommended strategies/packages to deal with the parallelization of many (thousands of) tasks that are: Individually relatively fast (costs associated to spawning may not be negligible). Possibly somewha…

---

## [Understanding weird @code\_warntype warning](https://discourse.julialang.org/t/understanding-weird-code-warntype-warning/71488)

<div class="topic-metadata">

**Author:** [@BambOoxX](https://discourse.julialang.org/u/BambOoxX)\
**Replies:** 6\
**Last updated:** [November 15, 2021, 6:24pm UTC](https://discourse.julialang.org/t/understanding-weird-code-warntype-warning/71488 "2021-11-15T18:24:27Z")

</div>

While testing one of my codes for type instability, I stumbled upon what feels like a strange behavior, emphasized by the example below. julia\> test(filepath::String) = @assert ispath(filepath) "File path $filepath is n…

---

## [Pmap, Folds.map and ThreadsX.map perform worse than map for a seemly parallel task](https://discourse.julialang.org/t/pmap-folds-map-and-threadsx-map-perform-worse-than-map-for-a-seemly-parallel-task/71437)

<div class="topic-metadata">

**Author:** [@anneJulia](https://discourse.julialang.org/u/anneJulia)\
**Replies:** 10\
**Last updated:** [November 15, 2021, 8:19am UTC](https://discourse.julialang.org/t/pmap-folds-map-and-threadsx-map-perform-worse-than-map-for-a-seemly-parallel-task/71437 "2021-11-15T08:19:10Z")

</div>

I am trying to parallelize a simple function (doTheTransit in the MWE below). I have opened Julia in the terminal with -p 6 since I have a 6-Core processor. Explanation of my MWE: With the function createNecessary I a…

---

## [Is PyCall slower than directly using Python?](https://discourse.julialang.org/t/is-pycall-slower-than-directly-using-python/71110)

<div class="topic-metadata">

**Author:** [@filchristou](https://discourse.julialang.org/u/filchristou)\
**Replies:** 10\
**Last updated:** [November 14, 2021, 1:03pm UTC](https://discourse.julialang.org/t/is-pycall-slower-than-directly-using-python/71110 "2021-11-14T13:03:42Z")

</div>

I was trying to benchmark some operations in python and since I wanted to do the metaanalysis in a Julia notebook, I found it convenient to use PyCall. I know that PyCall puts some extra overhead on the object conversio…

---

## [Trampolines](https://discourse.julialang.org/t/trampolines/71351)

<div class="topic-metadata">

**Author:** [@goerch](https://discourse.julialang.org/u/goerch)\
**Replies:** 6\
**Last updated:** [November 13, 2021, 12:03am UTC](https://discourse.julialang.org/t/trampolines/71351 "2021-11-13T00:03:16Z")

</div>

Hi guys, I was playing around with trampolines and the following program using BenchmarkTools fac(n) = n == 0 ? 1 : n \* fac(n - 1) pow(x, n) = n == 0 ? 1 : x \* pow(x, n - 1) n = 63 @btime fac($n) x = 2. n = 64 @btim…

---

## [Get\_variables from Symbolics](https://discourse.julialang.org/t/get-variables-from-symbolics/71366)

<div class="topic-metadata">

**Author:** [@yewalenikhil65](https://discourse.julialang.org/u/yewalenikhil65)\
**Replies:** 2\
**Last updated:** [November 12, 2021, 3:51pm UTC](https://discourse.julialang.org/t/get-variables-from-symbolics/71366 "2021-11-12T15:51:09Z")

</div>

the issue is more clearly described at this github issue comment link https://github.com/SciML/Catalyst.jl/issues/422#issuecomment-966919073 If anybody could explain, how to obtain variables from such expressions, eg, …

---

## [Type inference for recursive broadcasting operations](https://discourse.julialang.org/t/type-inference-for-recursive-broadcasting-operations/71336)

<div class="topic-metadata">

**Author:** [@Marco\_Lombardi](https://discourse.julialang.org/u/Marco_Lombardi)\
**Replies:** 6\
**Last updated:** [November 12, 2021, 2:21pm UTC](https://discourse.julialang.org/t/type-inference-for-recursive-broadcasting-operations/71336 "2021-11-12T14:21:49Z")

</div>

Apologizes for the relatively long minimal example. I want to write an efficient broadcasting which is able to sum results from different objects. As an example, suppose I want to compute the sum of periodic functions, …

---

## [Nested static arrays perform worse than nested arrays](https://discourse.julialang.org/t/nested-static-arrays-perform-worse-than-nested-arrays/70938)

<div class="topic-metadata">

**Author:** [@anneJulia](https://discourse.julialang.org/u/anneJulia)\
**Replies:** 14\
**Last updated:** [November 12, 2021, 11:02am UTC](https://discourse.julialang.org/t/nested-static-arrays-perform-worse-than-nested-arrays/70938 "2021-11-12T11:02:24Z")

</div>

I am performing array operations, where I retrieve elements of an array (this array is nested). The functions below are minimal working examples of what I am trying to do. using TimerOutputs using StaticArrays using Sta…

---

## [How to avoid allocations in recursive data structures](https://discourse.julialang.org/t/how-to-avoid-allocations-in-recursive-data-structures/71268)

<div class="topic-metadata">

**Author:** [@peremato](https://discourse.julialang.org/u/peremato)\
**Replies:** 3\
**Last updated:** [November 11, 2021, 4:00pm UTC](https://discourse.julialang.org/t/how-to-avoid-allocations-in-recursive-data-structures/71268 "2021-11-11T16:00:26Z")

</div>

For my project I need a tree-like data structure. Since I didn’t find a way to forward declare types I am using the trick of an abstract type instead of a reference a concrete type. The problem is that when using this da…

---

## [Computer specific slowdown on multi-threading on computer cluster (Linux)?](https://discourse.julialang.org/t/computer-specific-slowdown-on-multi-threading-on-computer-cluster-linux/57889)

<div class="topic-metadata">

**Author:** [@swishmas](https://discourse.julialang.org/u/swishmas)\
**Replies:** 27\
**Last updated:** [November 11, 2021, 1:44pm UTC](https://discourse.julialang.org/t/computer-specific-slowdown-on-multi-threading-on-computer-cluster-linux/57889 "2021-11-11T13:44:41Z")

</div>

I have a code that runs very fast on my laptop (~20 seconds). As a test, I put it onto a new cluster that I started using. The code took 30 minutes to run. This code uses a lot of multi-threading in a lot of places. I…

---

## [Conditional for function](https://discourse.julialang.org/t/conditional-for-function/71296)

<div class="topic-metadata">

**Author:** [@Sbeltranj](https://discourse.julialang.org/u/Sbeltranj)\
**Replies:** 3\
**Last updated:** [November 11, 2021, 1:11am UTC](https://discourse.julialang.org/t/conditional-for-function/71296 "2021-11-11T01:11:18Z")

</div>

Hi, I have a conditional inside the for loop, the conditional changes the function in each loop, but first i get the error “qxloc is not defined” so add qxloc (x) = nothing; but this does not solve the problem and the c…

---

## [Understanding allocations in GeometryBasics.jl](https://discourse.julialang.org/t/understanding-allocations-in-geometrybasics-jl/71252)

<div class="topic-metadata">

**Author:** [@peremato](https://discourse.julialang.org/u/peremato)\
**Replies:** 6\
**Last updated:** [November 10, 2021, 2:19pm UTC](https://discourse.julialang.org/t/understanding-allocations-in-geometrybasics-jl/71252 "2021-11-10T14:19:20Z")

</div>

I am currently using GeometryBasics.jl for a project. While optimizing the code, I noticed lots of memory allocations that hinders performance. Some of them I could figure it out but this one I cannot. Can somebody help …

---

## [DataFrames.jl data engineering performance compared with other softwares](https://discourse.julialang.org/t/dataframes-jl-data-engineering-performance-compared-with-other-softwares/71226)

<div class="topic-metadata">

**Author:** [@laut](https://discourse.julialang.org/u/laut)\
**Replies:** 6\
**Last updated:** [November 10, 2021, 7:26am UTC](https://discourse.julialang.org/t/dataframes-jl-data-engineering-performance-compared-with-other-softwares/71226 "2021-11-10T07:26:17Z")

</div>

Julia fares pretty well in these cross software comparisons https://h2oai.github.io/db-benchmark/

---

## [Convert 1-element Vector{Float64} in Float](https://discourse.julialang.org/t/convert-1-element-vector-float64-in-float/71242)

<div class="topic-metadata">

**Author:** [@Sbeltranj](https://discourse.julialang.org/u/Sbeltranj)\
**Replies:** 2\
**Last updated:** [November 10, 2021, 7:01am UTC](https://discourse.julialang.org/t/convert-1-element-vector-float64-in-float/71242 "2021-11-10T07:01:29Z")

</div>

Hi I want to convert a vector of 1 element, to a Float64, how to do it

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

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