# Performance

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

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

**Page:** 109

---

## [How to iterate the optimization model with the updated bounds of the variables?](https://discourse.julialang.org/t/how-to-iterate-the-optimization-model-with-the-updated-bounds-of-the-variables/46746)

<div class="topic-metadata">

**Author:** [@mamuniut09](https://discourse.julialang.org/u/mamuniut09)\
**Replies:** 1\
**Last updated:** [September 17, 2020, 7:57pm UTC](https://discourse.julialang.org/t/how-to-iterate-the-optimization-model-with-the-updated-bounds-of-the-variables/46746 "2020-09-17T19:57:24Z")

</div>

Hello all, The optimization code is given below. x\_min=1; x\_max=7; y\_min=2; y\_max=5; m= Model(with\_optimizer(Ipopt.Optimizer)) @variable(m, x\>=0) @variable(m, y\>=0) @variable(m, z) @variable(m, w) @constraint(m,…

---

## [How can I specialize similar and copy on a offset custom array?](https://discourse.julialang.org/t/how-can-i-specialize-similar-and-copy-on-a-offset-custom-array/46796)

<div class="topic-metadata">

**Author:** [@suavesito](https://discourse.julialang.org/u/suavesito)\
**Replies:** 0\
**Last updated:** [September 17, 2020, 6:17pm UTC](https://discourse.julialang.org/t/how-can-i-specialize-similar-and-copy-on-a-offset-custom-array/46796 "2020-09-17T18:17:36Z")

</div>

Hi All! :smiley: I have a Spinor struct, that Inherits from AbstractVector, but it’s index go from 0 to 2^{\\lfloor dim/2\\rfloor}-1, with dim a part of the Spinor struct, for this I’m using CustomUnitRanges.jl. The Spino…

---

## [Poor performance with custom multidimensional iterator](https://discourse.julialang.org/t/poor-performance-with-custom-multidimensional-iterator/46529)

<div class="topic-metadata">

**Author:** [@benninkrs](https://discourse.julialang.org/u/benninkrs)\
**Replies:** 4\
**Last updated:** [September 16, 2020, 5:48pm UTC](https://discourse.julialang.org/t/poor-performance-with-custom-multidimensional-iterator/46529 "2020-09-16T17:48:22Z")

</div>

I am trying to implement a custom iterator for multidimensional arrays, which among other things, allows one to specify the order in which the axes are iterated. Sadly, I am having trouble getting even close to the perfo…

---

## [Iterate with 1:N is faster than 1:length(A)](https://discourse.julialang.org/t/iterate-with-1-n-is-faster-than-1-length-a/46664)

<div class="topic-metadata">

**Author:** [@stakaz](https://discourse.julialang.org/u/stakaz)\
**Replies:** 12\
**Last updated:** [September 16, 2020, 3:17pm UTC](https://discourse.julialang.org/t/iterate-with-1-n-is-faster-than-1-length-a/46664 "2020-09-16T15:17:43Z")

</div>

Hello, I am about to benchmark different ways of iterate over an array and I have realized a strange thing (I am on julia 1.5.1) The following test: julia\> using BenchmarkTools julia\> function N\_iterator(A, N) …

---

## [Trouble Pre-allocating Outputs](https://discourse.julialang.org/t/trouble-pre-allocating-outputs/39610)

<div class="topic-metadata">

**Author:** [@loki](https://discourse.julialang.org/u/loki)\
**Replies:** 9\
**Last updated:** [September 16, 2020, 3:30am UTC](https://discourse.julialang.org/t/trouble-pre-allocating-outputs/39610 "2020-09-16T03:30:26Z")

</div>

Hello, I was hoping to get some advice regarding how to properly go about Pre-allocating outputs for a more complicated example and speeding a function. I’ve read through others’ posts and the performance guide but was s…

---

## [Optimizing concatenation of data from large number of files](https://discourse.julialang.org/t/optimizing-concatenation-of-data-from-large-number-of-files/46617)

<div class="topic-metadata">

**Author:** [@lwhitefox](https://discourse.julialang.org/u/lwhitefox)\
**Replies:** 2\
**Last updated:** [September 15, 2020, 5:05pm UTC](https://discourse.julialang.org/t/optimizing-concatenation-of-data-from-large-number-of-files/46617 "2020-09-15T17:05:26Z")

</div>

I am trying to create a large data array from data in many input files by reading in the individual data file arrays concatenating a subset of columns to generate a large, single array The problem is that it is blazin…

---

## [Performance of creating a tuple with a for loop](https://discourse.julialang.org/t/performance-of-creating-a-tuple-with-a-for-loop/46606)

<div class="topic-metadata">

**Author:** [@dogiv](https://discourse.julialang.org/u/dogiv)\
**Replies:** 26\
**Last updated:** [September 15, 2020, 1:11pm UTC](https://discourse.julialang.org/t/performance-of-creating-a-tuple-with-a-for-loop/46606 "2020-09-15T13:11:33Z")

</div>

I have a function “complement” that takes two tuples of ints and does a simple comparison to generate a third tuple. I would prefer to write it so that it works for any length of tuple, but that kills the performance (10…

---

## [Performance improvements for simple molecular surface caclulation](https://discourse.julialang.org/t/performance-improvements-for-simple-molecular-surface-caclulation/46514)

<div class="topic-metadata">

**Author:** [@v-a-s-a](https://discourse.julialang.org/u/v-a-s-a)\
**Replies:** 15\
**Last updated:** [September 14, 2020, 12:29am UTC](https://discourse.julialang.org/t/performance-improvements-for-simple-molecular-surface-caclulation/46514 "2020-09-14T00:29:08Z")

</div>

I have a fairly straightforward calculation I’ve been playing around with, and it seems like a good opportunity to learn a little more about typical optimizations people reach for, as well as coding style. At the core, …

---

## [Is there any overhead through too many threads?](https://discourse.julialang.org/t/is-there-any-overhead-through-too-many-threads/46559)

<div class="topic-metadata">

**Author:** [@fgerick](https://discourse.julialang.org/u/fgerick)\
**Replies:** 7\
**Last updated:** [September 13, 2020, 9:42pm UTC](https://discourse.julialang.org/t/is-there-any-overhead-through-too-many-threads/46559 "2020-09-13T21:42:39Z")

</div>

Hi everyone, sorry if this has already been answered somewhere, but my quick search didn’t really give me an answer. I was wondering if there is any possible performance regression when setting JULIA\_NUM\_THREADS larger…

---

## [CartesianIndices overhead](https://discourse.julialang.org/t/cartesianindices-overhead/46461)

<div class="topic-metadata">

**Author:** [@Benjia](https://discourse.julialang.org/u/Benjia)\
**Replies:** 9\
**Last updated:** [September 13, 2020, 4:29pm UTC](https://discourse.julialang.org/t/cartesianindices-overhead/46461 "2020-09-13T16:29:19Z")

</div>

I’ve been experimenting with the techniques described here Multidimensional algorithms and iteration for writing some generic multi-dimensional operations. Let’s look at a nan-skipping sum: function nansum!(B, A) #…

---

## [Frequency counts on a square lattice](https://discourse.julialang.org/t/frequency-counts-on-a-square-lattice/46533)

<div class="topic-metadata">

**Author:** [@gideonsimpson](https://discourse.julialang.org/u/gideonsimpson)\
**Replies:** 6\
**Last updated:** [September 13, 2020, 3:29pm UTC](https://discourse.julialang.org/t/frequency-counts-on-a-square-lattice/46533 "2020-09-13T15:29:31Z")

</div>

I have a square array, c, with integer entries that I expect to repeat. I would like to get frequency counts on the different indices, as they represent categorical data. I was wondering what might be the most efficien…

---

## [Rand() vs rand(rng)](https://discourse.julialang.org/t/rand-vs-rand-rng/46517)

<div class="topic-metadata">

**Author:** [@steve1313](https://discourse.julialang.org/u/steve1313)\
**Replies:** 4\
**Last updated:** [September 12, 2020, 7:20pm UTC](https://discourse.julialang.org/t/rand-vs-rand-rng/46517 "2020-09-12T19:20:22Z")

</div>

Hello. Why is rand(rng) ten times slower than rand() ? See code below: julia\> using Random julia\> rng = MersenneTwister(12345); julia\> function test() t0=time() x=0.0; for k=1:100000000 x+=rand(rng) end x,time…

---

## [Garbage collecting SharedArrays](https://discourse.julialang.org/t/garbage-collecting-sharedarrays/46510)

<div class="topic-metadata">

**Author:** [@atteson](https://discourse.julialang.org/u/atteson)\
**Replies:** 1\
**Last updated:** [September 12, 2020, 3:33pm UTC](https://discourse.julialang.org/t/garbage-collecting-sharedarrays/46510 "2020-09-12T15:33:43Z")

</div>

I’ve been using some very large SharedArrays. Occasionally, my code allocates one which it wants only for the duration of a function call. However, they don’t seem to be freed and the machine eventually runs out of mem…

---

## [Image in REPL does not correct](https://discourse.julialang.org/t/image-in-repl-does-not-correct/46359)

<div class="topic-metadata">

**Author:** [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Replies:** 16\
**Last updated:** [September 11, 2020, 9:33pm UTC](https://discourse.julialang.org/t/image-in-repl-does-not-correct/46359 "2020-09-11T21:33:47Z")

</div>

When running the ImageInTerminal package I get these images: And when I start ImageView I receive the following alert: using ImageView Julia\>using ImageView \[ Info: Precompiling ImageView \[86fae568-95e7-573e-a6b2-d8…

---

## [Understanding memory allocations](https://discourse.julialang.org/t/understanding-memory-allocations/46379)

<div class="topic-metadata">

**Author:** [@Philippe\_Maincon1](https://discourse.julialang.org/u/Philippe_Maincon1)\
**Replies:** 6\
**Last updated:** [September 11, 2020, 5:47am UTC](https://discourse.julialang.org/t/understanding-memory-allocations/46379 "2020-09-11T05:47:08Z")

</div>

I want fast code. :sunglasses: I will get a core meltdown. I try to understand why some code allocates while other doesn’t. Here is my little benchmark, and I cannot make head or tail of the results. b = Complex(1.,2…

---

## [BLAS vs CUBLAS benchmark](https://discourse.julialang.org/t/blas-vs-cublas-benchmark/46205)

<div class="topic-metadata">

**Author:** [@Szymon\_Zak](https://discourse.julialang.org/u/Szymon_Zak)\
**Replies:** 13\
**Last updated:** [September 11, 2020, 4:17am UTC](https://discourse.julialang.org/t/blas-vs-cublas-benchmark/46205 "2020-09-11T04:17:43Z")

</div>

Hello. I’m trying to compare BLAS and CUBLAS performance with Julia. For example, I want to compare matrix multiplication time. Let A, B, C will be \[NxN\] matrices. Which function, should I use to get something like C…

---

## [Optimizing a package: how to get started](https://discourse.julialang.org/t/optimizing-a-package-how-to-get-started/46341)

<div class="topic-metadata">

**Author:** [@mbaz](https://discourse.julialang.org/u/mbaz)\
**Replies:** 7\
**Last updated:** [September 10, 2020, 1:32pm UTC](https://discourse.julialang.org/t/optimizing-a-package-how-to-get-started/46341 "2020-09-10T13:32:37Z")

</div>

The improvements in Julia v1.5.1, tools like SnoopCompile.jl, and the recent posts by Tim Holy have motivated me to see if I can extract further performance from my plotting package Gaston. Being fairly new to this kind …

---

## [Something's buggy with array assignment .=?](https://discourse.julialang.org/t/somethings-buggy-with-array-assignment/46356)

<div class="topic-metadata">

**Author:** [@natgeo-wong](https://discourse.julialang.org/u/natgeo-wong)\
**Replies:** 6\
**Last updated:** [September 10, 2020, 9:18am UTC](https://discourse.julialang.org/t/somethings-buggy-with-array-assignment/46356 "2020-09-10T09:18:50Z")

</div>

function testnc( init::Dict,eroot::Dict; regID::AbstractString="GLB", timeID::Union{Integer,Vector}=0, gres::Real=0 ) emod,epar,ereg,etime = erainitialize( init; modID="dsfc",parID="p\_sfc…

---

## [What is the most performant way of bootstrapping a self-referential mutable struct?](https://discourse.julialang.org/t/what-is-the-most-performant-way-of-bootstrapping-a-self-referential-mutable-struct/46238)

<div class="topic-metadata">

**Author:** [@Lucas\_Queiroz](https://discourse.julialang.org/u/Lucas_Queiroz)\
**Replies:** 11\
**Last updated:** [September 9, 2020, 2:45pm UTC](https://discourse.julialang.org/t/what-is-the-most-performant-way-of-bootstrapping-a-self-referential-mutable-struct/46238 "2020-09-09T14:45:36Z")

</div>

Consider the self-referential struct below: mutable struct T field::T end The circularity in the way T was defined prevents me from ever constructing an object of type T. I have considered two ways out: mutable s…

---

## [Why do global variables impact performance so badly?](https://discourse.julialang.org/t/why-do-global-variables-impact-performance-so-badly/46293)

<div class="topic-metadata">

**Author:** [@originalsouth](https://discourse.julialang.org/u/originalsouth)\
**Replies:** 11\
**Last updated:** [September 9, 2020, 1:39pm UTC](https://discourse.julialang.org/t/why-do-global-variables-impact-performance-so-badly/46293 "2020-09-09T13:39:22Z")

</div>

I have two almost identical codes: #!/usr/bin/env julia using Random if(length(ARGS)==1) N=parse(Int64,ARGS\[1\]) else N=1000 end function play() r=0 counter=0.0 while r\<1.0 r+=rand(Float64)…

---

## [Arrays, Matrix, append!](https://discourse.julialang.org/t/arrays-matrix-append/46177)

<div class="topic-metadata">

**Author:** [@Lucas\_Gartner](https://discourse.julialang.org/u/Lucas_Gartner)\
**Replies:** 10\
**Last updated:** [September 8, 2020, 12:42pm UTC](https://discourse.julialang.org/t/arrays-matrix-append/46177 "2020-09-08T12:42:50Z")

</div>

Hey all, may you can tell me some insights about the arrays in julia and their dimension. I came from python3.7 and want to translate a python script to julia. I need to create a list, and iterate through a set of vecs…

---

## [Issorted for Dataframe rows](https://discourse.julialang.org/t/issorted-for-dataframe-rows/46251)

<div class="topic-metadata">

**Author:** [@bernhard](https://discourse.julialang.org/u/bernhard)\
**Replies:** 5\
**Last updated:** [September 8, 2020, 12:11pm UTC](https://discourse.julialang.org/t/issorted-for-dataframe-rows/46251 "2020-09-08T12:11:30Z")

</div>

I have a dataframe with a few dozen columns. For each row I want to ensure that a subset of the columns (let’s say the relevant columns are named x1 to x6) is sorted I was wondering whether there is a faster approach t…

---

## [Faster date parsing?](https://discourse.julialang.org/t/faster-date-parsing/46248)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 6\
**Last updated:** [September 8, 2020, 10:34am UTC](https://discourse.julialang.org/t/faster-date-parsing/46248 "2020-09-08T10:34:50Z")

</div>

I wonder if there is a faster date parsing package in Julia for example where the default Date parsing is quite slow versus a custom algorithm. using Dates date = Dates.format(Date(2020, 08, 09), "mm/dd/yyyy") using Be…

---

## [Tullio, LoopVectorization: \`pointer\` becomes slow for views because of \`Base.\_memory\_offset\` for \`ndims(...) \>= 5\`](https://discourse.julialang.org/t/tullio-loopvectorization-pointer-becomes-slow-for-views-because-of-base-memory-offset-for-ndims-5/46178)

<div class="topic-metadata">

**Author:** [@ranocha](https://discourse.julialang.org/u/ranocha)\
**Replies:** 1\
**Last updated:** [September 7, 2020, 7:04am UTC](https://discourse.julialang.org/t/tullio-loopvectorization-pointer-becomes-slow-for-views-because-of-base-memory-offset-for-ndims-5/46178 "2020-09-07T07:04:36Z")

</div>

While improving the performance of some code using Tullio.jl and LoopVectorization.jl, I recognized a significant performance impact when using views of Arrays with at least five indices. Since LoopVectorization.jl works…

---

## [Type instability for singleton tuple argument](https://discourse.julialang.org/t/type-instability-for-singleton-tuple-argument/46147)

<div class="topic-metadata">

**Author:** [@jlchan](https://discourse.julialang.org/u/jlchan)\
**Replies:** 5\
**Last updated:** [September 6, 2020, 4:09pm UTC](https://discourse.julialang.org/t/type-instability-for-singleton-tuple-argument/46147 "2020-09-06T16:09:47Z")

</div>

why do I get type instability for the function (x-\>x.^2).((1,))? if my input argument is a singleton tuple, then @code\_warntype (x-\>x.^2).((1,)) gives │ %4 = Base.materialize(%3)::Tuple{Any} └── return %4 If the…

---

## [Parallelize (pre) compilation?](https://discourse.julialang.org/t/parallelize-pre-compilation/46087)

<div class="topic-metadata">

**Author:** [@Samuel\_Ainsworth](https://discourse.julialang.org/u/Samuel_Ainsworth)\
**Replies:** 10\
**Last updated:** [September 6, 2020, 3:12pm UTC](https://discourse.julialang.org/t/parallelize-pre-compilation/46087 "2020-09-06T15:12:34Z")

</div>

I spend a lot of time staring at \[ Info: Precompiling X messages. AFAICT this process is completely single-threaded. This seems like a bit of a shame. I spent all this money on a nice beefy machine with a bunch of cores,…

---

## [When to use StaticArrays](https://discourse.julialang.org/t/when-to-use-staticarrays/46123)

<div class="topic-metadata">

**Author:** [@danielw2904](https://discourse.julialang.org/u/danielw2904)\
**Replies:** 4\
**Last updated:** [September 5, 2020, 11:11pm UTC](https://discourse.julialang.org/t/when-to-use-staticarrays/46123 "2020-09-05T23:11:31Z")

</div>

I have been looking into StaticArrays.jl to speed up linear algebra but I think I am doing something wrong or testing the wrong things. My first test was a simple linear model: using StaticArrays, Random, BenchmarkTool…

---

## [What is the correct way to access a variable number of workspaces with a variable number of threads?](https://discourse.julialang.org/t/what-is-the-correct-way-to-access-a-variable-number-of-workspaces-with-a-variable-number-of-threads/46111)

<div class="topic-metadata">

**Author:** [@cgeoga](https://discourse.julialang.org/u/cgeoga)\
**Replies:** 3\
**Last updated:** [September 5, 2020, 8:06pm UTC](https://discourse.julialang.org/t/what-is-the-correct-way-to-access-a-variable-number-of-workspaces-with-a-variable-number-of-threads/46111 "2020-09-05T20:06:23Z")

</div>

Hey all— I am trying to write a good thread-parallel implementation of a problem that can be described quickly like this: The user has to do n tasks, each of which require a workspace. They can provide any number of w…

---

## [Is there any limitation on threads' num for cpu without SMT？](https://discourse.julialang.org/t/is-there-any-limitation-on-threads-num-for-cpu-without-smt/46104)

<div class="topic-metadata">

**Author:** [@N5N3](https://discourse.julialang.org/u/N5N3)\
**Replies:** 2\
**Last updated:** [September 5, 2020, 3:01pm UTC](https://discourse.julialang.org/t/is-there-any-limitation-on-threads-num-for-cpu-without-smt/46104 "2020-09-05T15:01:52Z")

</div>

I’m using 9600KF with 6 cores and 6 threads, the following confuse me: If I start julia with 6 threads, then the cost of schedule(t::Task) = enq\_work(t) increases sharply somtime, while everythings seems ok with thread…

---

## [Error when installing registry](https://discourse.julialang.org/t/error-when-installing-registry/45999)

<div class="topic-metadata">

**Author:** [@HerAdri](https://discourse.julialang.org/u/HerAdri)\
**Replies:** 5\
**Last updated:** [September 4, 2020, 6:13am UTC](https://discourse.julialang.org/t/error-when-installing-registry/45999 "2020-09-04T06:13:22Z")

</div>

When you did the update, the following alert is displayed :. pkg\>up Installing known registries into C:\\Users\\hermesr\\.julia ERROR: SystemError: opening file “C:\\Users\\hermesr\\.julia\\registries\\General\\Registry.toml”:…

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

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