# Performance

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

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

**Page:** 107

---

## [Slow Deployment of Flux Mode](https://discourse.julialang.org/t/slow-deployment-of-flux-mode/48945)

<div class="topic-metadata">

**Author:** [@compleat](https://discourse.julialang.org/u/compleat)\
**Replies:** 5\
**Last updated:** [October 24, 2020, 5:29pm UTC](https://discourse.julialang.org/t/slow-deployment-of-flux-mode/48945 "2020-10-24T17:29:10Z")

</div>

Hi. I have a trained Flux model which I wish to apply repeatedly using separate calls from an external program. Since Julia1.5 (and corresponding Flux version) every time the function is called, the line using Flux r…

---

## [Ccall performance](https://discourse.julialang.org/t/ccall-performance/48872)

<div class="topic-metadata">

**Author:** [@j\_tanu](https://discourse.julialang.org/u/j_tanu)\
**Replies:** 16\
**Last updated:** [October 24, 2020, 2:37pm UTC](https://discourse.julialang.org/t/ccall-performance/48872 "2020-10-24T14:37:25Z")

</div>

Hi, I am doing a matrix-matrix multiplication A(12870\*11440)\*B(11440\*11440) using mkl\_dgemm library. In c language, The whole calculation takes about 20 sec but if I call the mkl\_dgemm using Julia’s ccall it takes 42.27…

---

## [1.0 vs Float64(1) versus const rone = 1.0](https://discourse.julialang.org/t/1-0-vs-float64-1-versus-const-rone-1-0/48874)

<div class="topic-metadata">

**Author:** [@grandemundo82](https://discourse.julialang.org/u/grandemundo82)\
**Replies:** 6\
**Last updated:** [October 23, 2020, 12:07pm UTC](https://discourse.julialang.org/t/1-0-vs-float64-1-versus-const-rone-1-0/48874 "2020-10-23T12:07:10Z")

</div>

Hi all; For the longest time, I wondered about something extremely basic. In my code where execution time is really important, I always wondered what is the best way to handle real number like 1.0 or 0.0. What is the f…

---

## [Calculation time of Runge Kutta method](https://discourse.julialang.org/t/calculation-time-of-runge-kutta-method/48869)

<div class="topic-metadata">

**Author:** [@yosuga](https://discourse.julialang.org/u/yosuga)\
**Replies:** 1\
**Last updated:** [October 23, 2020, 8:28am UTC](https://discourse.julialang.org/t/calculation-time-of-runge-kutta-method/48869 "2020-10-23T08:28:35Z")

</div>

I’m trying to calculate a matrix-form ODE, i.e., (∂/∂t)ψ = -iHψ ,where ψ is a vector and H is a (time-independent) matrix. I have two problems. 1. Difference of calculation time between DifferentialEquations.jl and Ru…

---

## [Threads.@spawn performance](https://discourse.julialang.org/t/threads-spawn-performance/48681)

<div class="topic-metadata">

**Author:** [@j\_tanu](https://discourse.julialang.org/u/j_tanu)\
**Replies:** 7\
**Last updated:** [October 22, 2020, 6:23am UTC](https://discourse.julialang.org/t/threads-spawn-performance/48681 "2020-10-22T06:23:37Z")

</div>

I am trying to perform a complex mathematical operation over the elements of two array. It’s a kind of broadcasting operation. I am trying to achieving the performance gain from threads.@spawn and @simd at the same time.…

---

## [BenchmarkTools.jl: @benchmark has big overhead](https://discourse.julialang.org/t/benchmarktools-jl-benchmark-has-big-overhead/48745)

<div class="topic-metadata">

**Author:** [@SonntagK](https://discourse.julialang.org/u/SonntagK)\
**Replies:** 6\
**Last updated:** [October 21, 2020, 2:10pm UTC](https://discourse.julialang.org/t/benchmarktools-jl-benchmark-has-big-overhead/48745 "2020-10-21T14:10:14Z")

</div>

Hello, I want to use BenchmarkTools to compare different model builds using JuMP for linear programming. Doing this for bigger linear problems took longer than I imagined. When looking at the results of @benchmark I no…

---

## [High-dimensional A\\b when running julia -p N](https://discourse.julialang.org/t/high-dimensional-a-b-when-running-julia-p-n/48669)

<div class="topic-metadata">

**Author:** [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Replies:** 7\
**Last updated:** [October 21, 2020, 1:10pm UTC](https://discourse.julialang.org/t/high-dimensional-a-b-when-running-julia-p-n/48669 "2020-10-21T13:10:03Z")

</div>

Hi, I am trying to optimise a function that solves a series of high-dimensional systems (using A\\b) in parallel (one per iteration of a for-loop). I am not sure whether it would be a good idea to have more cores than wh…

---

## [Reading multiple text files from a directory](https://discourse.julialang.org/t/reading-multiple-text-files-from-a-directory/48661)

<div class="topic-metadata">

**Author:** [@johnberg1](https://discourse.julialang.org/u/johnberg1)\
**Replies:** 1\
**Last updated:** [October 19, 2020, 10:57pm UTC](https://discourse.julialang.org/t/reading-multiple-text-files-from-a-directory/48661 "2020-10-19T22:57:13Z")

</div>

Hello all, I am very new to Julia and I have a question regarding reading some files. I need to read 12500 .txt files from the same directory and save them all into 1 array but I’m having performance issues. Is there a f…

---

## [Is UnionAll abstract? Is it bad for performance?](https://discourse.julialang.org/t/is-unionall-abstract-is-it-bad-for-performance/48653)

<div class="topic-metadata">

**Author:** [@JamesK](https://discourse.julialang.org/u/JamesK)\
**Replies:** 1\
**Last updated:** [October 19, 2020, 9:37pm UTC](https://discourse.julialang.org/t/is-unionall-abstract-is-it-bad-for-performance/48653 "2020-10-19T21:37:37Z")

</div>

Sorry in advance if this is covered somewhere; I’m still a beginner. I’m concerned about the two performance tips as they relate to UnionAll: 1) Avoid fields with abstract type and 2) Avoid containers with abstract type…

---

## [The performance of saturating operations or adding intrinsics](https://discourse.julialang.org/t/the-performance-of-saturating-operations-or-adding-intrinsics/48575)

<div class="topic-metadata">

**Author:** [@kimikage](https://discourse.julialang.org/u/kimikage)\
**Replies:** 10\
**Last updated:** [October 19, 2020, 4:37am UTC](https://discourse.julialang.org/t/the-performance-of-saturating-operations-or-adding-intrinsics/48575 "2020-10-19T04:37:17Z")

</div>

I (we) will support saturating arithmetic in FixedPointNumbers.jl as an experimental feature until the API design is mature. (If you’re interested in the background and API design, you can also see: ) Since the additi…

---

## [Why is there a performance penalty in evaluating the axes of an OffsetArray?](https://discourse.julialang.org/t/why-is-there-a-performance-penalty-in-evaluating-the-axes-of-an-offsetarray/48542)

<div class="topic-metadata">

**Author:** [@jishnub](https://discourse.julialang.org/u/jishnub)\
**Replies:** 5\
**Last updated:** [October 18, 2020, 3:01pm UTC](https://discourse.julialang.org/t/why-is-there-a-performance-penalty-in-evaluating-the-axes-of-an-offsetarray/48542 "2020-10-18T15:01:10Z")

</div>

Currently evaluating the axes of an OffsetArray is considerably slower than that of an Array as the former uses a custom axis type that wraps the axes of the parent. I am trying to understand how to improve the performan…

---

## [Multithreaded computation significantly slower](https://discourse.julialang.org/t/multithreaded-computation-significantly-slower/47474)

<div class="topic-metadata">

**Author:** [@Tamas\_Papp](https://discourse.julialang.org/u/Tamas_Papp)\
**Replies:** 18\
**Last updated:** [October 17, 2020, 1:06pm UTC](https://discourse.julialang.org/t/multithreaded-computation-significantly-slower/47474 "2020-10-17T13:06:50Z")

</div>

I have a numerical calculation (market clearing in a heterogeneous agent overlapping generations model) which is “embarrassingly parallel” in the sense that I can split it up to 10–30 parts that can run separately (the c…

---

## [Type instability in recursion](https://discourse.julialang.org/t/type-instability-in-recursion/48283)

<div class="topic-metadata">

**Author:** [@kogad](https://discourse.julialang.org/u/kogad)\
**Replies:** 11\
**Last updated:** [October 16, 2020, 5:59pm UTC](https://discourse.julialang.org/t/type-instability-in-recursion/48283 "2020-10-16T17:59:41Z")

</div>

Hi, I am implementing genetic programming (GP) in julia. GP needs to evaluate mathematical expressions represented by tree structures, and this is the bottleneck in my implementation. The following code can evaluate tre…

---

## [Scalar multiplication makes array reallocation](https://discourse.julialang.org/t/scalar-multiplication-makes-array-reallocation/48421)

<div class="topic-metadata">

**Author:** [@alequa](https://discourse.julialang.org/u/alequa)\
**Replies:** 14\
**Last updated:** [October 15, 2020, 11:39am UTC](https://discourse.julialang.org/t/scalar-multiplication-makes-array-reallocation/48421 "2020-10-15T11:39:47Z")

</div>

Hi everyone, While testing the fastest approach to multiply a matrix to a vector a discovered a nasty fact about reallocation. Multiplying a matrix for a constant-defined value (namely a scalar) makes Julia reallocate …

---

## [Best practices for profiling compilation](https://discourse.julialang.org/t/best-practices-for-profiling-compilation/48249)

<div class="topic-metadata">

**Author:** [@bkamins](https://discourse.julialang.org/u/bkamins)\
**Replies:** 5\
**Last updated:** [October 13, 2020, 3:40pm UTC](https://discourse.julialang.org/t/best-practices-for-profiling-compilation/48249 "2020-10-13T15:40:16Z")

</div>

In DataFrames.jl we see a strong trend that people want more and more powerful functions allowing for transformation of data frames (to match dplyr, data.table, pandas, …). This leads to a situation when code base becom…

---

## [Unstable type with dispatch by Val{:X}() with 5 functions](https://discourse.julialang.org/t/unstable-type-with-dispatch-by-val-x-with-5-functions/48072)

<div class="topic-metadata">

**Author:** [@PharmCat](https://discourse.julialang.org/u/PharmCat)\
**Replies:** 9\
**Last updated:** [October 12, 2020, 5:19pm UTC](https://discourse.julialang.org/t/unstable-type-with-dispatch-by-val-x-with-5-functions/48072 "2020-10-12T17:19:10Z")

</div>

When i use following code i have no problems with types using LinearAlgebra, BlockDiagonals function f1(x::Vector{T}, ::Int, ::Val{:A}) where T Diagonal(x) end function f1(x::Vector{T}, i::Int, ::Val{:B}) where T …

---

## [How to debug profiler warning about invalid memory location](https://discourse.julialang.org/t/how-to-debug-profiler-warning-about-invalid-memory-location/40477)

<div class="topic-metadata">

**Author:** [@alemelis](https://discourse.julialang.org/u/alemelis)\
**Replies:** 5\
**Last updated:** [October 12, 2020, 4:08pm UTC](https://discourse.julialang.org/t/how-to-debug-profiler-warning-about-invalid-memory-location/40477 "2020-10-12T16:08:12Z")

</div>

Hello, I was curious about profiling (and learning how to do it) a code I wrote. Reading the official guide (here), I came across the ProfileView.jl package. I simply used the @profview macro provided by the package and…

---

## [Is there a way to reshape a Vector to a row-major AbstractMatrix?](https://discourse.julialang.org/t/is-there-a-way-to-reshape-a-vector-to-a-row-major-abstractmatrix/48214)

<div class="topic-metadata">

**Author:** [@astrojhgu](https://discourse.julialang.org/u/astrojhgu)\
**Replies:** 4\
**Last updated:** [October 12, 2020, 3:13pm UTC](https://discourse.julialang.org/t/is-there-a-way-to-reshape-a-vector-to-a-row-major-abstractmatrix/48214 "2020-10-12T15:13:52Z")

</div>

I have a 1-D vector of size of (nm, 1), i.e., length=nm. I need to reshape it to a n rows m cols matrix, like 1 5 9 2 6 10 3 7 11 4 8 12 , but in memory it is row-majored. So that I can access its rows efficien…

---

## [How can I reset my Julia path in Atom?](https://discourse.julialang.org/t/how-can-i-reset-my-julia-path-in-atom/47818)

<div class="topic-metadata">

**Author:** [@JamesIrvineTrail](https://discourse.julialang.org/u/JamesIrvineTrail)\
**Replies:** 1\
**Last updated:** [October 12, 2020, 3:06pm UTC](https://discourse.julialang.org/t/how-can-i-reset-my-julia-path-in-atom/47818 "2020-10-12T15:06:25Z")

</div>

I upgraded to the latest versions of both Julia and Atom on Windows 10 Pro. I used the Windows uninstaller to uninstall the older versions; after that I deleted the .atom and .julia subfolders in my Users folder to make …

---

## [Understanding the performance costs of generating functions on the fly](https://discourse.julialang.org/t/understanding-the-performance-costs-of-generating-functions-on-the-fly/47990)

<div class="topic-metadata">

**Author:** [@pdeffebach](https://discourse.julialang.org/u/pdeffebach)\
**Replies:** 10\
**Last updated:** [October 11, 2020, 12:35am UTC](https://discourse.julialang.org/t/understanding-the-performance-costs-of-generating-functions-on-the-fly/47990 "2020-10-11T00:35:37Z")

</div>

Hello, I’m trying to figure out the best way for DataFramesMeta and I want to understand the performance implications of the following. Go through an expression and find all the symbols that are in the propertynames of…

---

## [Domain representation](https://discourse.julialang.org/t/domain-representation/47965)

<div class="topic-metadata">

**Author:** [@Azzaare](https://discourse.julialang.org/u/Azzaare)\
**Replies:** 2\
**Last updated:** [October 8, 2020, 10:53pm UTC](https://discourse.julialang.org/t/domain-representation/47965 "2020-10-08T22:53:26Z")

</div>

Hi there! EDIT: I am trying to provide a type/structure overview, so please be patient if you want/need more details about my question I am writing a solver where I have to represent the domain of each variable. I was …

---

## [Memory allocation and @profile](https://discourse.julialang.org/t/memory-allocation-and-profile/47573)

<div class="topic-metadata">

**Author:** [@Ross\_Boylan](https://discourse.julialang.org/u/Ross_Boylan)\
**Replies:** 5\
**Last updated:** [October 8, 2020, 2:24pm UTC](https://discourse.julialang.org/t/memory-allocation-and-profile/47573 "2020-10-08T14:24:42Z")

</div>

@time shows that my program is doing a lot of memory allocation, much of which I could probably avoid. For example @time b2 = MyFirst.mysolve(f2, nhsub, nhsub.wtfast16yr) 1.998780 seconds (6.27 M allocations: 479.828 Mi…

---

## [Enum versus abstract typing](https://discourse.julialang.org/t/enum-versus-abstract-typing/47941)

<div class="topic-metadata">

**Author:** [@davide-f](https://discourse.julialang.org/u/davide-f)\
**Replies:** 8\
**Last updated:** [October 7, 2020, 5:31pm UTC](https://discourse.julialang.org/t/enum-versus-abstract-typing/47941 "2020-10-07T17:31:22Z")

</div>

Hi, I am developing a code aiming at a good balance between speed, resources and generalizability. In my original code that was using only concrete assets, mainly, the code was relatively fast, about 68ms. Aiming to ge…

---

## [Store abstract types in a container](https://discourse.julialang.org/t/store-abstract-types-in-a-container/47764)

<div class="topic-metadata">

**Author:** [@isentropic](https://discourse.julialang.org/u/isentropic)\
**Replies:** 7\
**Last updated:** [October 6, 2020, 5:00am UTC](https://discourse.julialang.org/t/store-abstract-types-in-a-container/47764 "2020-10-06T05:00:36Z")

</div>

What is the best way to store abstract types in an array let’s say: I have array world geometry. Each world component is essentially an object. Each array element could be A or B type, but both A\<:C, B\<:C. So I need a A…

---

## [Independent LU factorization of small matrices not faster with threads](https://discourse.julialang.org/t/independent-lu-factorization-of-small-matrices-not-faster-with-threads/47694)

<div class="topic-metadata">

**Author:** [@hcarlsso](https://discourse.julialang.org/u/hcarlsso)\
**Replies:** 10\
**Last updated:** [October 5, 2020, 4:06pm UTC](https://discourse.julialang.org/t/independent-lu-factorization-of-small-matrices-not-faster-with-threads/47694 "2020-10-05T16:06:14Z")

</div>

My problem is that I want to solve many small linear systems of size 3x3, and to do it in parallel, using LU factorization. using LinearAlgebra using TimerOutputs using Random reset\_timer!() function f\_lu(N) Rando…

---

## [3D Matrix vs Array of 2D Matrices using Comprehensions](https://discourse.julialang.org/t/3d-matrix-vs-array-of-2d-matrices-using-comprehensions/47688)

<div class="topic-metadata">

**Author:** [@jleman](https://discourse.julialang.org/u/jleman)\
**Replies:** 5\
**Last updated:** [October 5, 2020, 2:24pm UTC](https://discourse.julialang.org/t/3d-matrix-vs-array-of-2d-matrices-using-comprehensions/47688 "2020-10-05T14:24:30Z")

</div>

I am trying to populate a large, dense 3D matrix (3000 x 18 x 1000). I tried iterating over all positions of the 3D matrix (testing various row/column iteration orders) - see Attempt 1. I also tried array comprehension…

---

## [Fastest way to simulate the birthday paradox](https://discourse.julialang.org/t/fastest-way-to-simulate-the-birthday-paradox/47756)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 2\
**Last updated:** [October 5, 2020, 3:58am UTC](https://discourse.julialang.org/t/fastest-way-to-simulate-the-birthday-paradox/47756 "2020-10-05T03:58:46Z")

</div>

Trying to write a script for a video to explain some Julia programming concepts. Was trying to use the birthday “paradox” as example. It states that in a room of 23 ppl, there is a 50% chance that at least one pair of pe…

---

## [Suggestions needed: speed up optimization](https://discourse.julialang.org/t/suggestions-needed-speed-up-optimization/47449)

<div class="topic-metadata">

**Author:** [@DShiu](https://discourse.julialang.org/u/DShiu)\
**Replies:** 31\
**Last updated:** [October 4, 2020, 7:06pm UTC](https://discourse.julialang.org/t/suggestions-needed-speed-up-optimization/47449 "2020-10-04T19:06:19Z")

</div>

I need to maximize a likelihood function which has 18 parameters using a large sample with 1 million observations. The objective function is defined as function loglike(θ, x, y, R, c, d, p0, B) prob = \[choice\_prob\_n…

---

## [Multiply dense arrays](https://discourse.julialang.org/t/multiply-dense-arrays/47724)

<div class="topic-metadata">

**Author:** [@jleman](https://discourse.julialang.org/u/jleman)\
**Replies:** 14\
**Last updated:** [October 4, 2020, 6:38pm UTC](https://discourse.julialang.org/t/multiply-dense-arrays/47724 "2020-10-04T18:38:11Z")

</div>

Is there a way to speed up basic multiplication of dense arrays? I have the following: using BenchmarkTools multiplyAndSum(Gmρ,Gρq) = sum(Gmρ .\* Gρq) dim = 500 #target is 3000 Gmρ = \[rand(dim,18) for \_ in 1:1024\] Gρq…

---

## [Operations on elements of a common index of an array of matrices](https://discourse.julialang.org/t/operations-on-elements-of-a-common-index-of-an-array-of-matrices/47715)

<div class="topic-metadata">

**Author:** [@jleman](https://discourse.julialang.org/u/jleman)\
**Replies:** 7\
**Last updated:** [October 4, 2020, 3:05pm UTC](https://discourse.julialang.org/t/operations-on-elements-of-a-common-index-of-an-array-of-matrices/47715 "2020-10-04T15:05:06Z")

</div>

I have an array of matrices. Is it possible to update groups of common indices in place? The code below doesn’t work but I think conveys what I am trying to do. Yes it would be easier to do this with a 3D matrix, but …

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

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