# Performance

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

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

**Page:** 129

---

## [Unexplained gap between calculation, and fetch time](https://discourse.julialang.org/t/unexplained-gap-between-calculation-and-fetch-time/25980)

<div class="topic-metadata">

**Author:** [@Dinari](https://discourse.julialang.org/u/Dinari)\
**Replies:** 0\
**Last updated:** [July 3, 2019, 11:22am UTC](https://discourse.julialang.org/t/unexplained-gap-between-calculation-and-fetch-time/25980 "2019-07-03T11:22:54Z")

</div>

In my code I have a rather simple architecture, Master process send some calculation to a worker, the calculation is done on a DArray, and the master collects it using fetch. However, I have a big unexplained gap betwee…

---

## [Help me Improve my poker hand evaluator](https://discourse.julialang.org/t/help-me-improve-my-poker-hand-evaluator/19360)

<div class="topic-metadata">

**Author:** [@rapasite](https://discourse.julialang.org/u/rapasite)\
**Replies:** 11\
**Last updated:** [January 14, 2019, 9:32am UTC](https://discourse.julialang.org/t/help-me-improve-my-poker-hand-evaluator/19360 "2019-01-14T09:32:53Z")

</div>

Hi, I am making a poker hand evaluator for fun. the deck of card is represent by the 52 first bits (low value) of a UInt64 like so: 0000/0000/0000/AAAA/KKKK/QQQQ/JJJJ/10,10,10,10/9999/8888/7777/6666/5555/4444/3333/222…

---

## [Significant decrease in performance after seemingly irrelevant changes](https://discourse.julialang.org/t/significant-decrease-in-performance-after-seemingly-irrelevant-changes/25796)

<div class="topic-metadata">

**Author:** [@Tusike](https://discourse.julialang.org/u/Tusike)\
**Replies:** 16\
**Last updated:** [June 29, 2019, 3:29pm UTC](https://discourse.julialang.org/t/significant-decrease-in-performance-after-seemingly-irrelevant-changes/25796 "2019-06-29T15:29:57Z")

</div>

Hi! I recently revised some aspects of a large project I’m working on, just moving around some data/functions without altering the behavior of the code. However, it resulted in significant decrease in performance in see…

---

## [Recommended env variables for most performant parallel/multithreading?](https://discourse.julialang.org/t/recommended-env-variables-for-most-performant-parallel-multithreading/25631)

<div class="topic-metadata">

**Author:** [@alvrg](https://discourse.julialang.org/u/alvrg)\
**Replies:** 3\
**Last updated:** [June 25, 2019, 3:00pm UTC](https://discourse.julialang.org/t/recommended-env-variables-for-most-performant-parallel-multithreading/25631 "2019-06-25T15:00:39Z")

</div>

Hi all, I have two questions. What are the recommended values of the env variables (JULIA\_NUM\_THREADS, MKL/OPENBLAS\_NUM\_THREADS, …) if I want to speed up my code using Threads.@threads? To what should I set those v…

---

## [Performance: Building directed graph of game scores (0,0) -\> (0,1) etc](https://discourse.julialang.org/t/performance-building-directed-graph-of-game-scores-0-0-0-1-etc/25736)

<div class="topic-metadata">

**Author:** [@gabiteodoru](https://discourse.julialang.org/u/gabiteodoru)\
**Replies:** 9\
**Last updated:** [June 28, 2019, 6:17am UTC](https://discourse.julialang.org/t/performance-building-directed-graph-of-game-scores-0-0-0-1-etc/25736 "2019-06-28T06:17:55Z")

</div>

I’m building a directed graph of possible game scores from (0,0) up to a score of N, together with a dictionary pointing from the score to the corresponding node. I’d like to make it as efficient as possible. Currently …

---

## [Efficient Implementation of Loop for Bootstrapping Statistics](https://discourse.julialang.org/t/efficient-implementation-of-loop-for-bootstrapping-statistics/25675)

<div class="topic-metadata">

**Author:** [@slakeon](https://discourse.julialang.org/u/slakeon)\
**Replies:** 5\
**Last updated:** [June 27, 2019, 11:39pm UTC](https://discourse.julialang.org/t/efficient-implementation-of-loop-for-bootstrapping-statistics/25675 "2019-06-27T23:39:19Z")

</div>

I am trying to build a loop for a standard recursive-design residual-based nonparametric bootstrap algorithm for a Vector Autoregression (VAR). However, so far, I’m struggling to find an efficient way of writing the algo…

---

## [Fast logsumexp](https://discourse.julialang.org/t/fast-logsumexp/22827)

<div class="topic-metadata">

**Author:** [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Replies:** 14\
**Last updated:** [June 26, 2019, 3:21pm UTC](https://discourse.julialang.org/t/fast-logsumexp/22827 "2019-06-26T15:21:46Z")

</div>

We recently held a competition among the students in a Julia course we are teaching. The goal of the competition was to profile and optimize a provided particle-filter simulation. After all the obvious things were taken …

---

## [Surprised that broadcast does not use views?](https://discourse.julialang.org/t/surprised-that-broadcast-does-not-use-views/25662)

<div class="topic-metadata">

**Author:** [@Krastanov](https://discourse.julialang.org/u/Krastanov)\
**Replies:** 8\
**Last updated:** [June 26, 2019, 7:35am UTC](https://discourse.julialang.org/t/surprised-that-broadcast-does-not-use-views/25662 "2019-06-26T07:35:44Z")

</div>

I am using a simple broadcast expression, and getting a surprising (to me) result depending on whether I use views or not. #setup a = rand(UInt64, 1000, 1000) b = rand(UInt64, 1000, 1000) c = rand(UInt64, 1000); Doing …

---

## [Non-allocating loop over a set of structs](https://discourse.julialang.org/t/non-allocating-loop-over-a-set-of-structs/25643)

<div class="topic-metadata">

**Author:** [@fedoroff](https://discourse.julialang.org/u/fedoroff)\
**Replies:** 13\
**Last updated:** [June 25, 2019, 3:22pm UTC](https://discourse.julialang.org/t/non-allocating-loop-over-a-set-of-structs/25643 "2019-06-25T15:22:42Z")

</div>

I have a set of structs and I want to loop over them. The following code shows two possible loops together with a sequential one by one access to structs: using BenchmarkTools struct Sample{T\<:AbstractFloat, F\<:Functio…

---

## [Bounds in function arguments](https://discourse.julialang.org/t/bounds-in-function-arguments/25635)

<div class="topic-metadata">

**Author:** [@fipelle](https://discourse.julialang.org/u/fipelle)\
**Replies:** 4\
**Last updated:** [June 25, 2019, 10:55am UTC](https://discourse.julialang.org/t/bounds-in-function-arguments/25635 "2019-06-25T10:55:00Z")

</div>

Hi, I am writing down a set of functions, and I want to make sure that some of the arguments are bounded within some given values. For the sake of simplicity, say that I only have the following function: function my\_f…

---

## [Matrix (dense) vector (sparse) product improvement](https://discourse.julialang.org/t/matrix-dense-vector-sparse-product-improvement/25579)

<div class="topic-metadata">

**Author:** [@davidbp](https://discourse.julialang.org/u/davidbp)\
**Replies:** 7\
**Last updated:** [June 24, 2019, 4:28pm UTC](https://discourse.julialang.org/t/matrix-dense-vector-sparse-product-improvement/25579 "2019-06-24T16:28:15Z")

</div>

Products W'\*x\_sp seem very slow when W is a dense array and x\_sp is an sparse vector. Odly enough this does not happen if we don’t have and adjoint (W\*x\_sp is fast but W'\*x\_sp is very slow). Is there an easy way to o…

---

## [Tuples of closures](https://discourse.julialang.org/t/tuples-of-closures/25506)

<div class="topic-metadata">

**Author:** [@cgeoga](https://discourse.julialang.org/u/cgeoga)\
**Replies:** 5\
**Last updated:** [June 21, 2019, 7:38pm UTC](https://discourse.julialang.org/t/tuples-of-closures/25506 "2019-06-21T19:38:14Z")

</div>

Hi all—I have a use case where I have a collection of functions that I want to include in a struct. I know the number of functions at compile time, but they will be made into closures with run-time data. It has been sugg…

---

## [Help me get rid of extra allocations in this generic batching iterator](https://discourse.julialang.org/t/help-me-get-rid-of-extra-allocations-in-this-generic-batching-iterator/25061)

<div class="topic-metadata">

**Author:** [@Roger-luo](https://discourse.julialang.org/u/Roger-luo)\
**Replies:** 3\
**Last updated:** [June 21, 2019, 12:21am UTC](https://discourse.julialang.org/t/help-me-get-rid-of-extra-allocations-in-this-generic-batching-iterator/25061 "2019-06-21T00:21:59Z")

</div>

I’m trying to make the routines in BatchedRoutines more generic, so I could wrap other BLAS routines to use pointer offsets easier. However, when I wrap the iteration to a function, the batched\_gemm routine become type u…

---

## [Result diverges on 129th iteration?](https://discourse.julialang.org/t/result-diverges-on-129th-iteration/25453)

<div class="topic-metadata">

**Author:** [@chakravala](https://discourse.julialang.org/u/chakravala)\
**Replies:** 3\
**Last updated:** [June 19, 2019, 7:01pm UTC](https://discourse.julialang.org/t/result-diverges-on-129th-iteration/25453 "2019-06-19T19:01:43Z")

</div>

My goal is to make the implementation of my qlog function specialized for MultiVector types. In the Grassmann.jl package, I have the generic Grassmann.qlog implementation, which has a lot of unnecessary allocations made…

---

## [Approach to avoid memory allocation with struct with abstract type fields](https://discourse.julialang.org/t/approach-to-avoid-memory-allocation-with-struct-with-abstract-type-fields/24822)

<div class="topic-metadata">

**Author:** [@sfriedowitz](https://discourse.julialang.org/u/sfriedowitz)\
**Replies:** 8\
**Last updated:** [June 19, 2019, 5:47pm UTC](https://discourse.julialang.org/t/approach-to-avoid-memory-allocation-with-struct-with-abstract-type-fields/24822 "2019-06-19T17:47:46Z")

</div>

I am working on some molecular simulation code, and am hitting a road block on figuring on a good design structure to avoid memory allocation for a container that will store different concrete subtypes of a single abstra…

---

## [Performance Help, Algorithm Is Not Scaling Well](https://discourse.julialang.org/t/performance-help-algorithm-is-not-scaling-well/25315)

<div class="topic-metadata">

**Author:** [@dburch](https://discourse.julialang.org/u/dburch)\
**Replies:** 15\
**Last updated:** [June 19, 2019, 3:02pm UTC](https://discourse.julialang.org/t/performance-help-algorithm-is-not-scaling-well/25315 "2019-06-19T15:02:58Z")

</div>

I have an array with arrays inside. I created an algorithm to find duplicated elements in arrays in the array. It works correctly, but when I start scaling up to thousands or tens of thousands of records, then it is not …

---

## [Does compilation time for methods depend on input?](https://discourse.julialang.org/t/does-compilation-time-for-methods-depend-on-input/25440)

<div class="topic-metadata">

**Author:** [@srb](https://discourse.julialang.org/u/srb)\
**Replies:** 5\
**Last updated:** [June 19, 2019, 1:12pm UTC](https://discourse.julialang.org/t/does-compilation-time-for-methods-depend-on-input/25440 "2019-06-19T13:12:16Z")

</div>

Just a simple questions about compile times, Say I have a function that takes an Integer argument and does some calculations depending on said integer. Does the compilation time depend on how big the integer is? Say, f…

---

## [How to specify the type of a Tracked CuArray?](https://discourse.julialang.org/t/how-to-specify-the-type-of-a-tracked-cuarray/25406)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 0\
**Last updated:** [June 18, 2019, 12:37pm UTC](https://discourse.julialang.org/t/how-to-specify-the-type-of-a-tracked-cuarray/25406 "2019-06-18T12:37:41Z")

</div>

Hello, I have a function that calls neural networks on the gpu and I would like to specify the return type for performances. using Flux net = Chain(Dense(3,2,relu)) |\> gpu function foo(net::Chain, input::CuArray{Float3…

---

## [Improving performance of tensor contractions](https://discourse.julialang.org/t/improving-performance-of-tensor-contractions/25180)

<div class="topic-metadata">

**Author:** [@alvrg](https://discourse.julialang.org/u/alvrg)\
**Replies:** 7\
**Last updated:** [June 14, 2019, 9:18pm UTC](https://discourse.julialang.org/t/improving-performance-of-tensor-contractions/25180 "2019-06-14T21:18:40Z")

</div>

Hi all, I want to build a function that takes several tensors, contracts them, and outputs a tensor as a final result. I was using TensorOperations.jl as a draft, but I felt I could improve the performance making the co…

---

## [ImageView/Gtk Unstable Results](https://discourse.julialang.org/t/imageview-gtk-unstable-results/25267)

<div class="topic-metadata">

**Author:** [@rand5](https://discourse.julialang.org/u/rand5)\
**Replies:** 1\
**Last updated:** [June 13, 2019, 8:26pm UTC](https://discourse.julialang.org/t/imageview-gtk-unstable-results/25267 "2019-06-13T20:26:59Z")

</div>

I’m working on some code using ImageView to show an image in a Gtk window and grab the (x,y) coordinate where the user clicks within the window. I based it on the Calling imshow from a script file section of the ImageVie…

---

## [Are there any fundamental parts of Julia's design or implementation that could limit its performance?](https://discourse.julialang.org/t/are-there-any-fundamental-parts-of-julias-design-or-implementation-that-could-limit-its-performance/25256)

<div class="topic-metadata">

**Author:** [@jackf](https://discourse.julialang.org/u/jackf)\
**Replies:** 6\
**Last updated:** [June 13, 2019, 7:07pm UTC](https://discourse.julialang.org/t/are-there-any-fundamental-parts-of-julias-design-or-implementation-that-could-limit-its-performance/25256 "2019-06-13T19:07:26Z")

</div>

Consider two programs, one written in Julia and one in, say, C++. The Julia program is well written: no type instabilities, not too many allocations, bounds checks disabled, etc. The two programs are structurally similar…

---

## [Parsing expressions into functions](https://discourse.julialang.org/t/parsing-expressions-into-functions/25108)

<div class="topic-metadata">

**Author:** [@JesseSantoso](https://discourse.julialang.org/u/JesseSantoso)\
**Replies:** 22\
**Last updated:** [June 11, 2019, 9:17am UTC](https://discourse.julialang.org/t/parsing-expressions-into-functions/25108 "2019-06-11T09:17:17Z")

</div>

Hi, I’m relatively new to Julia but feel like I’m mostly getting the hang of it. I have a project where I need to parse a large number of arbitrary expressions (e.g. ax^b, a+bx^2, etc.) into a function, but I’m running …

---

## [Fast evaluation of multiple functions on multiple arguments](https://discourse.julialang.org/t/fast-evaluation-of-multiple-functions-on-multiple-arguments/25040)

<div class="topic-metadata">

**Author:** [@simsurace](https://discourse.julialang.org/u/simsurace)\
**Replies:** 10\
**Last updated:** [June 7, 2019, 2:36pm UTC](https://discourse.julialang.org/t/fast-evaluation-of-multiple-functions-on-multiple-arguments/25040 "2019-06-07T14:36:46Z")

</div>

In my application I often have a bunch of functions that I need to evaluate on many arguments (i.e. each combination of function and argument). I thought of extending the Base.map function as follows: function Base.map…

---

## [Efficiently Calculate Matrices Defined Recursively](https://discourse.julialang.org/t/efficiently-calculate-matrices-defined-recursively/25006)

<div class="topic-metadata">

**Author:** [@Joseph\_Saia](https://discourse.julialang.org/u/Joseph_Saia)\
**Replies:** 1\
**Last updated:** [June 6, 2019, 12:48pm UTC](https://discourse.julialang.org/t/efficiently-calculate-matrices-defined-recursively/25006 "2019-06-06T12:48:11Z")

</div>

In my work I frequently have to calculate a long sequence (about N=10^6) of small matrices (about 3x3) that are defined recursively like X\_t = f(X\_{t-1}). The object of interest is the entire chain of matrices so I need …

---

## [Type defintions of composite types with concrete dimensions](https://discourse.julialang.org/t/type-defintions-of-composite-types-with-concrete-dimensions/24991)

<div class="topic-metadata">

**Author:** [@Volker](https://discourse.julialang.org/u/Volker)\
**Replies:** 1\
**Last updated:** [June 6, 2019, 8:04am UTC](https://discourse.julialang.org/t/type-defintions-of-composite-types-with-concrete-dimensions/24991 "2019-06-06T08:04:35Z")

</div>

Hello, I would like to improve the performance of my code. And now starting to make stable types. Is it possible to create types with a concrete dimension in a struct with other fields of the struct? I know that this is…

---

## [Problem with a variable](https://discourse.julialang.org/t/problem-with-a-variable/24954)

<div class="topic-metadata">

**Author:** [@opihor](https://discourse.julialang.org/u/opihor)\
**Replies:** 2\
**Last updated:** [June 5, 2019, 2:17pm UTC](https://discourse.julialang.org/t/problem-with-a-variable/24954 "2019-06-05T14:17:09Z")

</div>

Why this code doesn’t work ? I have the error : maxL not defined " maxL=0 for j in 1:size(jobs\_in\_file,1) if ((ordered\_jobs\[j\].start\_time + ordered\_jobs\[j\].proc) \> ordered\_jobs\[j\].due) maxl1 = maxL + 0 maxL = max(o…

---

## [Cant push! JuliaInterpreter.compiled\_methods](https://discourse.julialang.org/t/cant-push-juliainterpreter-compiled-methods/24901)

<div class="topic-metadata">

**Author:** [@Bokken](https://discourse.julialang.org/u/Bokken)\
**Replies:** 2\
**Last updated:** [June 4, 2019, 11:30am UTC](https://discourse.julialang.org/t/cant-push-juliainterpreter-compiled-methods/24901 "2019-06-04T11:30:07Z")

</div>

How can I add a function to JuliaInterpreter.compiled\_methods? function println\_(x) println(x) end push!(JuliaInterpreter.compiled\_methods,println\_) ----\> MethodError: Cannot convert an object of type typeof(println…

---

## [Speed-up JuMP model storing objects as Indexed tables](https://discourse.julialang.org/t/speed-up-jump-model-storing-objects-as-indexed-tables/24760)

<div class="topic-metadata">

**Author:** [@lgo](https://discourse.julialang.org/u/lgo)\
**Replies:** 5\
**Last updated:** [May 31, 2019, 11:02am UTC](https://discourse.julialang.org/t/speed-up-jump-model-storing-objects-as-indexed-tables/24760 "2019-05-31T11:02:59Z")

</div>

Hello, I’m new to Jula/JuMP and working on a very large optimization model, which generation I aim to fully automatize based on sets, relations among sets and parameters provided externally. I developed a basic procedur…

---

## [Switching out the underlying array in a SubArray](https://discourse.julialang.org/t/switching-out-the-underlying-array-in-a-subarray/24727)

<div class="topic-metadata">

**Author:** [@FHell](https://discourse.julialang.org/u/FHell)\
**Replies:** 19\
**Last updated:** [May 30, 2019, 8:43am UTC](https://discourse.julialang.org/t/switching-out-the-underlying-array-in-a-subarray/24727 "2019-05-30T08:43:30Z")

</div>

Hi everyone, I am developing a package for simulating (possibly very heterogeneous) dynamical systems that live on networks: It’s very early days but usable, we just pushed v0.1. The core of this package is a loop ov…

---

## [IF...ELSEIF...ELSE performance](https://discourse.julialang.org/t/if-elseif-else-performance/24622)

<div class="topic-metadata">

**Author:** [@drmartinrohde](https://discourse.julialang.org/u/drmartinrohde)\
**Replies:** 16\
**Last updated:** [May 29, 2019, 1:47pm UTC](https://discourse.julialang.org/t/if-elseif-else-performance/24622 "2019-05-29T13:47:06Z")

</div>

I need to use an IF…ELSEIF…ELSE statement in a large loop and I therefore did the following test to find the fastest implementation. In the following code a random number between 0 and 5 is chosen. Based on this outcome,…

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

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