# Performance

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

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

**Page:** 142

---

## [Efficiently using single large dataframe over multiple workers](https://discourse.julialang.org/t/efficiently-using-single-large-dataframe-over-multiple-workers/11696)

<div class="topic-metadata">

**Author:** [@dgcbritto](https://discourse.julialang.org/u/dgcbritto)\
**Replies:** 10\
**Last updated:** [June 15, 2018, 7:10pm UTC](https://discourse.julialang.org/t/efficiently-using-single-large-dataframe-over-multiple-workers/11696 "2018-06-15T19:10:21Z")

</div>

I’m new to Julia and programming in general. I need to run many linear regressions using exactly the same large dataset 5GB+. I’ve wrote a code to run each regression over different workers. Essentially, I’m copying the …

---

## [Julia Performance vs. C](https://discourse.julialang.org/t/julia-performance-vs-c/11675)

<div class="topic-metadata">

**Author:** [@jinliangwei](https://discourse.julialang.org/u/jinliangwei)\
**Replies:** 8\
**Last updated:** [June 15, 2018, 1:29pm UTC](https://discourse.julialang.org/t/julia-performance-vs-c/11675 "2018-06-15T13:29:12Z")

</div>

I wonder if someone has taken a closer look at the Julia microbenchmarks or has some better understanding of what causes the performance difference between Julia and C. I am guessing that Julia has a higher overhead for…

---

## [Restrictive Type Aliases?](https://discourse.julialang.org/t/restrictive-type-aliases/10546)

<div class="topic-metadata">

**Author:** [@nhipsman](https://discourse.julialang.org/u/nhipsman)\
**Replies:** 11\
**Last updated:** [June 12, 2018, 4:54am UTC](https://discourse.julialang.org/t/restrictive-type-aliases/10546 "2018-06-12T04:54:25Z")

</div>

Hi, I’m trying to define a type alias in a way that is actually restrictive. For instance, distance travelled = rate \* time, where all 3 (distances, rates, and times) are inherently floats. I want to define 3 types: a…

---

## [Avoiding functions in types; performance comparison & invitation for code review](https://discourse.julialang.org/t/avoiding-functions-in-types-performance-comparison-invitation-for-code-review/11555)

<div class="topic-metadata">

**Author:** [@jcook](https://discourse.julialang.org/u/jcook)\
**Replies:** 8\
**Last updated:** [June 10, 2018, 8:14am UTC](https://discourse.julialang.org/t/avoiding-functions-in-types-performance-comparison-invitation-for-code-review/11555 "2018-06-10T08:14:02Z")

</div>

Dear All, I’m attempting to go full Julia and not store functions in a type. The meat of my problem requires doing a some quadrature using QuadGK.jl on the product of some bessel functions using SpecialFunctions.jl and …

---

## [Help understanding vectorization (or lack thereof)](https://discourse.julialang.org/t/help-understanding-vectorization-or-lack-thereof/11518)

<div class="topic-metadata">

**Author:** [@raminammour](https://discourse.julialang.org/u/raminammour)\
**Replies:** 15\
**Last updated:** [June 8, 2018, 12:00am UTC](https://discourse.julialang.org/t/help-understanding-vectorization-or-lack-thereof/11518 "2018-06-08T00:00:55Z")

</div>

Hello, I have these simple functions, one with @simd and one without: @noinline function msum(x) s=zero(eltype(x)) for i in 1:length(x) @inbounds s+=x\[i\] end s end @noinline…

---

## [Performance details of StaticArray](https://discourse.julialang.org/t/performance-details-of-staticarray/11506)

<div class="topic-metadata">

**Author:** [@Gyslain](https://discourse.julialang.org/u/Gyslain)\
**Replies:** 5\
**Last updated:** [June 7, 2018, 11:04pm UTC](https://discourse.julialang.org/t/performance-details-of-staticarray/11506 "2018-06-07T23:04:39Z")

</div>

Hello! In the StaticArray documentation, we read : The speed of small SVectors, SMatrixs and SArrays is often \> 10 × faster than Base.Array These results improve significantly when using julia -O3 with immutable stati…

---

## [Take action based on Distribution type in a type stable way?](https://discourse.julialang.org/t/take-action-based-on-distribution-type-in-a-type-stable-way/11487)

<div class="topic-metadata">

**Author:** [@gabrielgellner](https://discourse.julialang.org/u/gabrielgellner)\
**Replies:** 2\
**Last updated:** [June 7, 2018, 1:43am UTC](https://discourse.julialang.org/t/take-action-based-on-distribution-type-in-a-type-stable-way/11487 "2018-06-07T01:43:59Z")

</div>

I want to make a function that transforms some information given what kind of Distributions type a variable has. Something like: tdist = typeof(prob.dist) if tdist == Distributions.Gamma{Float64} par\_transform\[i\] =…

---

## [Memory allocation problem](https://discourse.julialang.org/t/memory-allocation-problem/11352)

<div class="topic-metadata">

**Author:** [@jinliangwei](https://discourse.julialang.org/u/jinliangwei)\
**Replies:** 6\
**Last updated:** [June 2, 2018, 7:43pm UTC](https://discourse.julialang.org/t/memory-allocation-problem/11352 "2018-06-02T19:43:42Z")

</div>

I profiled by my program by tracking user memory allocation. The program seems to incur memory allocation at places I don’t expect. My program is pretty long so I have it updated to Github: https://github.com/jinliangwe…

---

## [Improving serialization time](https://discourse.julialang.org/t/improving-serialization-time/11318)

<div class="topic-metadata">

**Author:** [@jinliangwei](https://discourse.julialang.org/u/jinliangwei)\
**Replies:** 7\
**Last updated:** [June 2, 2018, 4:27am UTC](https://discourse.julialang.org/t/improving-serialization-time/11318 "2018-06-02T04:27:58Z")

</div>

I have a object which is essentially a = \[\[(Int64(10), Int32(2)) for i = 1:500\] for i = 1:102661\]. Serializing it takes 1.9 seconds. This has become a major bottleneck in my program because it has to be down repeatedly. …

---

## [Speedup of \`\\\` solver bottleneck](https://discourse.julialang.org/t/speedup-of-solver-bottleneck/11279)

<div class="topic-metadata">

**Author:** [@stst](https://discourse.julialang.org/u/stst)\
**Replies:** 8\
**Last updated:** [June 1, 2018, 3:33am UTC](https://discourse.julialang.org/t/speedup-of-solver-bottleneck/11279 "2018-06-01T03:33:19Z")

</div>

Below is my implementation of the block principal pivoting algorithm for solving a non-negative linear least squares problem. This function is the bottleneck in my code (running on v0.6.2), which calls this in an inner l…

---

## [Advice for structure](https://discourse.julialang.org/t/advice-for-structure/11260)

<div class="topic-metadata">

**Author:** [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Replies:** 2\
**Last updated:** [May 30, 2018, 2:58pm UTC](https://discourse.julialang.org/t/advice-for-structure/11260 "2018-05-30T14:58:27Z")

</div>

Hi, I am working with couples of vectors x,p where the size of x (resp. p) is fixed. I thought about using mutable struct Cp{T} x::Vector{T} p::Vector{T} end However, I would like to overload the operators so tha…

---

## [Efficient memory allocation for large system of ODEs](https://discourse.julialang.org/t/efficient-memory-allocation-for-large-system-of-odes/11226)

<div class="topic-metadata">

**Author:** [@swainarpit](https://discourse.julialang.org/u/swainarpit)\
**Replies:** 2\
**Last updated:** [May 29, 2018, 12:54pm UTC](https://discourse.julialang.org/t/efficient-memory-allocation-for-large-system-of-odes/11226 "2018-05-29T12:54:16Z")

</div>

Hi, I have a system of differential equations that mimic the clonal population in an immune system. For whoever is curious, the problem definition can be found in the post: At present, I am simulating with a small nu…

---

## [Efficient heatmap/general data updating](https://discourse.julialang.org/t/efficient-heatmap-general-data-updating/11203)

<div class="topic-metadata">

**Author:** [@Oz\_Wilson](https://discourse.julialang.org/u/Oz_Wilson)\
**Replies:** 2\
**Last updated:** [May 28, 2018, 6:53pm UTC](https://discourse.julialang.org/t/efficient-heatmap-general-data-updating/11203 "2018-05-28T18:53:28Z")

</div>

I am making a gif of diffusion using a series of heatmaps, and come from a Matlab background. In that environment, it was far more efficient to directly set the z-data of a current plot instead of redrawing the plot afte…

---

## [Trouble Speeding up Vectorized Functions with Parallelism](https://discourse.julialang.org/t/trouble-speeding-up-vectorized-functions-with-parallelism/11179)

<div class="topic-metadata">

**Author:** [@Juser](https://discourse.julialang.org/u/Juser)\
**Replies:** 12\
**Last updated:** [May 28, 2018, 10:45am UTC](https://discourse.julialang.org/t/trouble-speeding-up-vectorized-functions-with-parallelism/11179 "2018-05-28T10:45:12Z")

</div>

I am running a 16-core machine and and trying to parallelize some simple vectorized code. As the simplest possible example, below is a piece of test-code in which I just try to parallelize the vectorized exp function. …

---

## ["@." can induce poor performance sometimes](https://discourse.julialang.org/t/can-induce-poor-performance-sometimes/11170)

<div class="topic-metadata">

**Author:** [@1115](https://discourse.julialang.org/u/1115)\
**Replies:** 7\
**Last updated:** [May 26, 2018, 9:47pm UTC](https://discourse.julialang.org/t/can-induce-poor-performance-sometimes/11170 "2018-05-26T21:47:24Z")

</div>

@. macro, it will put a . behind some user defined function even though it is applited on a scalar and there is no available bmask.. Interestingly, it causes a lot of memory allocation, inducing a poor performance. jul…

---

## [Composite Types of Arrays](https://discourse.julialang.org/t/composite-types-of-arrays/11110)

<div class="topic-metadata">

**Author:** [@Juser](https://discourse.julialang.org/u/Juser)\
**Replies:** 2\
**Last updated:** [May 26, 2018, 8:09pm UTC](https://discourse.julialang.org/t/composite-types-of-arrays/11110 "2018-05-26T20:09:08Z")

</div>

I would like to do something like: type Vecs{V,T} A::V{T} B::V{T} end where V could be Vector or SharedVector or some other specified AbstractVector and T is some sort of bits-type. I understand that I cou…

---

## [push! showing better performance than pre-allocation for Vector?](https://discourse.julialang.org/t/push-showing-better-performance-than-pre-allocation-for-vector/11136)

<div class="topic-metadata">

**Author:** [@shushman](https://discourse.julialang.org/u/shushman)\
**Replies:** 4\
**Last updated:** [May 25, 2018, 10:35am UTC](https://discourse.julialang.org/t/push-showing-better-performance-than-pre-allocation-for-vector/11136 "2018-05-25T10:35:13Z")

</div>

I’ll just post the code snippets - they are quite self-explanatory. That said, I am still learning the nitty-gritties of Julia so please bear with me. vect = Vector{Int}(1000000) @time for i = 1:1000000 vect\[i\] =…

---

## [Is rebuilding the system image necessary?](https://discourse.julialang.org/t/is-rebuilding-the-system-image-necessary/11078)

<div class="topic-metadata">

**Author:** [@drinkwell](https://discourse.julialang.org/u/drinkwell)\
**Replies:** 1\
**Last updated:** [May 23, 2018, 7:54am UTC](https://discourse.julialang.org/t/is-rebuilding-the-system-image-necessary/11078 "2018-05-23T07:54:59Z")

</div>

I remember reading this blog post by @ChrisRackauckas a while ago. ‘Gotcha #7’ mentions rebuilding the system image so that you get hardware specific optimisations. Is this still necessary? I’m using JuliaPro in case …

---

## [Aligned Julia Arrays?](https://discourse.julialang.org/t/aligned-julia-arrays/10993)

<div class="topic-metadata">

**Author:** [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Replies:** 37\
**Last updated:** [May 21, 2018, 9:43pm UTC](https://discourse.julialang.org/t/aligned-julia-arrays/10993 "2018-05-21T21:43:17Z")

</div>

Hi, Is it possible to control the data alignment of Julia Arrays (for example to enable direct use of the vloada function of SIMD.jl package) ?

---

## [How to speed up array comparisons?](https://discourse.julialang.org/t/how-to-speed-up-array-comparisons/11019)

<div class="topic-metadata">

**Author:** [@Noel\_Araujo](https://discourse.julialang.org/u/Noel_Araujo)\
**Replies:** 12\
**Last updated:** [May 20, 2018, 7:11am UTC](https://discourse.julialang.org/t/how-to-speed-up-array-comparisons/11019 "2018-05-20T07:11:06Z")

</div>

I need to fix a bottleneck in my code during comparison of an array and a variable. I’ve tested the map() function and it speed up my code only when I declare the number directly. If I store my number inside a variable …

---

## [Power function with Integer ( x^4 much slower than x\*x\*x\*x )](https://discourse.julialang.org/t/power-function-with-integer-x-4-much-slower-than-x-x-x-x/10985)

<div class="topic-metadata">

**Author:** [@JonasIsensee](https://discourse.julialang.org/u/JonasIsensee)\
**Replies:** 12\
**Last updated:** [May 18, 2018, 2:41pm UTC](https://discourse.julialang.org/t/power-function-with-integer-x-4-much-slower-than-x-x-x-x/10985 "2018-05-18T14:41:49Z")

</div>

Hey there! I have a question. I need to calculate the following in a hot-loop: ω(d, dmax) = (1-(d/dmax)^2)^4 I benchmarked different versions of this and found the following using BenchmarkTools d = rand(10000) dm …

---

## [How does broadcast! work ? Tips for memory efficiency while using 'kron'](https://discourse.julialang.org/t/how-does-broadcast-work-tips-for-memory-efficiency-while-using-kron/10957)

<div class="topic-metadata">

**Author:** [@amitjamadagni](https://discourse.julialang.org/u/amitjamadagni)\
**Replies:** 1\
**Last updated:** [May 17, 2018, 2:55pm UTC](https://discourse.julialang.org/t/how-does-broadcast-work-tips-for-memory-efficiency-while-using-kron/10957 "2018-05-17T14:55:40Z")

</div>

I was trying to use broadcast! in place of broadcast in the following code : function \_tensor\_product\_(st) ten = st\[1\] for s in st\[2:end\] ten = kron(ten, s) end return ten end @noinline functio…

---

## [Improve the performance of multiplication of an arbitrary number of matrices](https://discourse.julialang.org/t/improve-the-performance-of-multiplication-of-an-arbitrary-number-of-matrices/10835)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 36\
**Last updated:** [May 16, 2018, 3:50am UTC](https://discourse.julialang.org/t/improve-the-performance-of-multiplication-of-an-arbitrary-number-of-matrices/10835 "2018-05-16T03:50:46Z")

</div>

Hi guys! I need to make a function that multiplies an arbitrary number of matrices. My current attempt is the following: @inline function compose\_rotation(D1::Matrix, Ds::Matrix...) for Di in Ds D1 = Di\*D1 …

---

## [Getting types right with functional programming](https://discourse.julialang.org/t/getting-types-right-with-functional-programming/10906)

<div class="topic-metadata">

**Author:** [@Ward9250](https://discourse.julialang.org/u/Ward9250)\
**Replies:** 0\
**Last updated:** [May 15, 2018, 10:58am UTC](https://discourse.julialang.org/t/getting-types-right-with-functional-programming/10906 "2018-05-15T10:58:39Z")

</div>

Hi, I want to process some records in an iterable, and wanted to try and do it in as functional style as possible: using BioSequences stream = open("tables3PITGs.fasta", "r") reader = FASTA.Reader(stream) # Set up reade…

---

## [Sum performance for Array{Float64,2} elements](https://discourse.julialang.org/t/sum-performance-for-array-float64-2-elements/10873)

<div class="topic-metadata">

**Author:** [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Replies:** 13\
**Last updated:** [May 15, 2018, 7:02am UTC](https://discourse.julialang.org/t/sum-performance-for-array-float64-2-elements/10873 "2018-05-15T07:02:14Z")

</div>

Hi, I try to implement efficiently the sum of 2D arrays of size (4,N). I fail to obtain good performance with different implementations: msum\_native corresponds to the std Julia sum method, msum\_2D1D corresponds to a…

---

## [Improving Speed for a Novice](https://discourse.julialang.org/t/improving-speed-for-a-novice/10886)

<div class="topic-metadata">

**Author:** [@Donald\_Williams](https://discourse.julialang.org/u/Donald_Williams)\
**Replies:** 7\
**Last updated:** [May 14, 2018, 5:47pm UTC](https://discourse.julialang.org/t/improving-speed-for-a-novice/10886 "2018-05-14T17:47:22Z")

</div>

Hi: I am mostly a R user, but am currently developing a package that has the primary functions written in Julia. This package is for estimating very large (inverse) co-variance matrices. I have considerable speed gains …

---

## [Mapreduce over selected indices](https://discourse.julialang.org/t/mapreduce-over-selected-indices/10866)

<div class="topic-metadata">

**Author:** [@jekyllstein](https://discourse.julialang.org/u/jekyllstein)\
**Replies:** 3\
**Last updated:** [May 13, 2018, 5:26pm UTC](https://discourse.julialang.org/t/mapreduce-over-selected-indices/10866 "2018-05-13T17:26:24Z")

</div>

I was writing a program involving a lot of mapreduce operations over pieces of arrays. To make things concrete here I’ll use the example of a sum over squared elements of an array: using BenchmarkTools x = rand(10000) …

---

## [Matrix permanent](https://discourse.julialang.org/t/matrix-permanent/10766)

<div class="topic-metadata">

**Author:** [@benkj](https://discourse.julialang.org/u/benkj)\
**Replies:** 7\
**Last updated:** [May 7, 2018, 10:26pm UTC](https://discourse.julialang.org/t/matrix-permanent/10766 "2018-05-07T22:26:02Z")

</div>

Any idea on how to improve the following code for computing the permanent of a matrix? I used the Glynn formula where delta is obtained via Gray code. # from https://stackoverflow.com/questions/34236332/c-code-for-gen…

---

## [Slow block of neural network](https://discourse.julialang.org/t/slow-block-of-neural-network/10716)

<div class="topic-metadata">

**Author:** [@economyboy](https://discourse.julialang.org/u/economyboy)\
**Replies:** 4\
**Last updated:** [May 6, 2018, 6:06pm UTC](https://discourse.julialang.org/t/slow-block-of-neural-network/10716 "2018-05-06T18:06:35Z")

</div>

I just translated a neuronal network from Python to Julia. It is already significantly faster than the Python NN, but written in Pascal it is still almost 20 times faster than the Julia version. By using the @time macro …

---

## [Strided addition on 2 arrays in place](https://discourse.julialang.org/t/strided-addition-on-2-arrays-in-place/10713)

<div class="topic-metadata">

**Author:** [@lcambier](https://discourse.julialang.org/u/lcambier)\
**Replies:** 2\
**Last updated:** [May 4, 2018, 6:58pm UTC](https://discourse.julialang.org/t/strided-addition-on-2-arrays-in-place/10713 "2018-05-04T18:58:48Z")

</div>

Hi, I have this simple code to add part of an array (contiguous rows / some columns) into another arrays (some rows / some columns). The first array is stored as a long vector so some reshape & other are necessary. In p…

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

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