# Performance

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

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

**Page:** 136

---

## [Sluggish performance when loading in modules DataFrames, CSV](https://discourse.julialang.org/t/sluggish-performance-when-loading-in-modules-dataframes-csv/17857)

<div class="topic-metadata">

**Author:** [@thvhauwe](https://discourse.julialang.org/u/thvhauwe)\
**Replies:** 0\
**Last updated:** [November 22, 2018, 12:32pm UTC](https://discourse.julialang.org/t/sluggish-performance-when-loading-in-modules-dataframes-csv/17857 "2018-11-22T12:32:34Z")

</div>

Just loading in the modules CSV and DataFrames takes up nearly 10 seconds, are there ways to improve this? When looking for solution to this slowish load time I stumbled upon this thread, claiming Plots and DataFrame…

---

## [Small benchmark](https://discourse.julialang.org/t/small-benchmark/17665)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 14\
**Last updated:** [November 21, 2018, 4:37pm UTC](https://discourse.julialang.org/t/small-benchmark/17665 "2018-11-21T16:37:41Z")

</div>

I’m new to Julia, and was curious to test its famed performance, so today I made a small benchmark comparing it to C, optimized Python and Scala. Some pretty interesting results, with Julia falling a mere 3% behind the b…

---

## [Macro hygiene in nested quote not working](https://discourse.julialang.org/t/macro-hygiene-in-nested-quote-not-working/17806)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 11\
**Last updated:** [November 21, 2018, 1:07pm UTC](https://discourse.julialang.org/t/macro-hygiene-in-nested-quote-not-working/17806 "2018-11-21T13:07:15Z")

</div>

unfortunately I face severe problems when dealing with macros with nested quotes. Somehow the standard hygiene does not seem to work… three examples, all failing first experiment .. fails module NestedQuoteHygiene exp…

---

## [Problems Installing Julia and MKL OSX](https://discourse.julialang.org/t/problems-installing-julia-and-mkl-osx/17102)

<div class="topic-metadata">

**Author:** [@davidbp](https://discourse.julialang.org/u/davidbp)\
**Replies:** 6\
**Last updated:** [November 19, 2018, 7:25pm UTC](https://discourse.julialang.org/t/problems-installing-julia-and-mkl-osx/17102 "2018-11-19T19:25:21Z")

</div>

Hello guys, I tried to install julia with MKL but I got an error when compiling the code. I pretty much followed what is explained here: Do you have any hints on what to do? Here I list the steps I took: My steps …

---

## [Building Julia: Does the compiler matter?](https://discourse.julialang.org/t/building-julia-does-the-compiler-matter/6858)

<div class="topic-metadata">

**Author:** [@carstenbauer](https://discourse.julialang.org/u/carstenbauer)\
**Replies:** 3\
**Last updated:** [November 19, 2018, 7:11pm UTC](https://discourse.julialang.org/t/building-julia-does-the-compiler-matter/6858 "2018-11-19T19:11:44Z")

</div>

I want to use Julia with MKL. As has been discussed, one currently has two options: use Julia Pro or build Julia from sources and setting flags. For many reasons I want to take the second approach. Regarding performance…

---

## [Source code from "Julia: Dynamism and Performance Reconciled by Design"?](https://discourse.julialang.org/t/source-code-from-julia-dynamism-and-performance-reconciled-by-design/17610)

<div class="topic-metadata">

**Author:** [@igouy](https://discourse.julialang.org/u/igouy)\
**Replies:** 4\
**Last updated:** [November 19, 2018, 7:01pm UTC](https://discourse.julialang.org/t/source-code-from-julia-dynamism-and-performance-reconciled-by-design/17610 "2018-11-19T19:01:57Z")

</div>

The paper \[pdf\] “Julia: Dynamism and Performance Reconciled by Design” shows relative performance (Fig 7) of some Julia implementations of benchmarks game programs — pidigits, regex, revcomp, … Are those Julia programs …

---

## [Migrating code from Matlab: Accessing arrays without allocating](https://discourse.julialang.org/t/migrating-code-from-matlab-accessing-arrays-without-allocating/17433)

<div class="topic-metadata">

**Author:** [@HenrikM](https://discourse.julialang.org/u/HenrikM)\
**Replies:** 20\
**Last updated:** [November 19, 2018, 3:37pm UTC](https://discourse.julialang.org/t/migrating-code-from-matlab-accessing-arrays-without-allocating/17433 "2018-11-19T15:37:25Z")

</div>

One of the performance critical parts of my Matlab code is this: function M = MFdiff(x1, x2) % Computes a flattened multidimensional x1' - x2 % x1 is (d x n1) % x2 is (d x n2) % M is (d x n1 \* n2) n1 = size(x1, 2); n2…

---

## [Help reduce large gc time](https://discourse.julialang.org/t/help-reduce-large-gc-time/17215)

<div class="topic-metadata">

**Author:** [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Replies:** 32\
**Last updated:** [November 18, 2018, 6:56am UTC](https://discourse.julialang.org/t/help-reduce-large-gc-time/17215 "2018-11-18T06:56:46Z")

</div>

Hi, In PDMP.jl, I have some large gc time reported. I looked at the performance tips and it seems my code is not type stable. For example, considering the example tcp.jl, I find that pdmp! is not type stable even if th…

---

## [Reassigning variable in do syntax is not optimized, \`\`Ref\`\` is, what is the difference?](https://discourse.julialang.org/t/reassigning-variable-in-do-syntax-is-not-optimized-ref-is-what-is-the-difference/17635)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 1\
**Last updated:** [November 17, 2018, 9:00am UTC](https://discourse.julialang.org/t/reassigning-variable-in-do-syntax-is-not-optimized-ref-is-what-is-the-difference/17635 "2018-11-17T09:00:53Z")

</div>

I frequently stumble about examples similar to the following, where I have a helper function which supports do style anonymous functions helper(cont, range) = for i ∈ range cont(i) end and want to write something whi…

---

## [Is this a valid @pure function?](https://discourse.julialang.org/t/is-this-a-valid-pure-function/17577)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 3\
**Last updated:** [November 16, 2018, 4:58pm UTC](https://discourse.julialang.org/t/is-this-a-valid-pure-function/17577 "2018-11-16T16:58:51Z")

</div>

Hi julia pros, is the following function safe to be annotated with @pure? Base.@pure getParameters(t::Type) = Tuple{t.parameters...} it would be soo awesome, because this indeed supports type inference

---

## [When does julia infer optimal code, when not?](https://discourse.julialang.org/t/when-does-julia-infer-optimal-code-when-not/17592)

<div class="topic-metadata">

**Author:** [@schlichtanders](https://discourse.julialang.org/u/schlichtanders)\
**Replies:** 4\
**Last updated:** [November 16, 2018, 12:09pm UTC](https://discourse.julialang.org/t/when-does-julia-infer-optimal-code-when-not/17592 "2018-11-16T12:09:32Z")

</div>

Dear julia pros, lets say I have a basic function fn(i::Integer) = 5 which and another function gn(i::Integer) = ... what is all allowed in gn so that @code\_llvm fn(3) @code\_llvm gn(3) return very similar results, i.…

---

## [Is there way to avoid \`materialize\` and \`copy\`?](https://discourse.julialang.org/t/is-there-way-to-avoid-materialize-and-copy/17467)

<div class="topic-metadata">

**Author:** [@misha\_mikhasenko](https://discourse.julialang.org/u/misha_mikhasenko)\
**Replies:** 20\
**Last updated:** [November 15, 2018, 12:37pm UTC](https://discourse.julialang.org/t/is-there-way-to-avoid-materialize-and-copy/17467 "2018-11-15T12:37:37Z")

</div>

I have a function createLLHandGRAD(data, kw...) which returns several callbacks. One of them is the LLH function function LLH(pars) # get a vector of parameters @inbounds res = sum(log(COHSQ(EXTND(data\[e,:\]).\*p…

---

## [Help Optimizing Slow Distributed Array Computation](https://discourse.julialang.org/t/help-optimizing-slow-distributed-array-computation/17478)

<div class="topic-metadata">

**Author:** [@JTomlinson](https://discourse.julialang.org/u/JTomlinson)\
**Replies:** 7\
**Last updated:** [November 14, 2018, 1:52pm UTC](https://discourse.julialang.org/t/help-optimizing-slow-distributed-array-computation/17478 "2018-11-14T13:52:04Z")

</div>

I’m in the process of converting some old C code to Julia but am having issues getting the performance to be even close. The specific function that takes most of the time, in the Julia code atleast, is the following @ev…

---

## [Array views becoming dominant source of memory allocation](https://discourse.julialang.org/t/array-views-becoming-dominant-source-of-memory-allocation/6465)

<div class="topic-metadata">

**Author:** [@bingcrosby](https://discourse.julialang.org/u/bingcrosby)\
**Replies:** 31\
**Last updated:** [November 14, 2018, 12:27pm UTC](https://discourse.julialang.org/t/array-views-becoming-dominant-source-of-memory-allocation/6465 "2018-11-14T12:27:27Z")

</div>

Hi All, I need to process 2D matrix data in short blocks, for example: function times\_one!(x::SubArray{Float64,2}) @. x= 1.0\*x end function test(dim\_long,dim\_short,step) x= rand(dim\_long,dim\_short) @time for i…

---

## [Could the usage of \`haskey\` be unidiomatic/inefficient?](https://discourse.julialang.org/t/could-the-usage-of-haskey-be-unidiomatic-inefficient/17442)

<div class="topic-metadata">

**Author:** [@SZJX](https://discourse.julialang.org/u/SZJX)\
**Replies:** 6\
**Last updated:** [November 13, 2018, 1:45am UTC](https://discourse.julialang.org/t/could-the-usage-of-haskey-be-unidiomatic-inefficient/17442 "2018-11-13T01:45:01Z")

</div>

It seems to be a common pattern to me that something like this needs to be done: if !haskey(dict, key) ... else item = dict\[key\] ... end Would this lead to two lookups and thus cause extra overhead? I considered…

---

## [Does GC overhead scale with memory consumption?](https://discourse.julialang.org/t/does-gc-overhead-scale-with-memory-consumption/17175)

<div class="topic-metadata">

**Author:** [@jwu](https://discourse.julialang.org/u/jwu)\
**Replies:** 4\
**Last updated:** [November 12, 2018, 2:39pm UTC](https://discourse.julialang.org/t/does-gc-overhead-scale-with-memory-consumption/17175 "2018-11-12T14:39:40Z")

</div>

Does the GC overhead scale with memory consumption, since GC have to scan the heap? this is some tests with Julia 0.7.0 julia\> @time GC.gc() 0.429078 seconds (4 allocations…

---

## [Allocations when manipulating an iterator](https://discourse.julialang.org/t/allocations-when-manipulating-an-iterator/17405)

<div class="topic-metadata">

**Author:** [@miles.lubin](https://discourse.julialang.org/u/miles.lubin)\
**Replies:** 5\
**Last updated:** [November 12, 2018, 8:53am UTC](https://discourse.julialang.org/t/allocations-when-manipulating-an-iterator/17405 "2018-11-12T08:53:52Z")

</div>

I distilled a significant performance issue in JuMP 0.19-alpha (https://github.com/JuliaOpt/JuMP.jl/issues/1403#issuecomment-437630140) to the following standalone example: using BenchmarkTools struct FlippedDictIterat…

---

## [Help with optimizing GC time with large objects in memory](https://discourse.julialang.org/t/help-with-optimizing-gc-time-with-large-objects-in-memory/17327)

<div class="topic-metadata">

**Author:** [@jthomasnull](https://discourse.julialang.org/u/jthomasnull)\
**Replies:** 3\
**Last updated:** [November 10, 2018, 3:32am UTC](https://discourse.julialang.org/t/help-with-optimizing-gc-time-with-large-objects-in-memory/17327 "2018-11-10T03:32:53Z")

</div>

I need to keep a large object (a DataFrame, like 20GB large) in memory, and as a result I’m seeing very large GC times. An example: function t1(indexes::Vector{Int64},ranges::Vector{UnitRange{Int64}})::Vector{Vector{Int…

---

## [Stdin/stdout 10x slower than file open](https://discourse.julialang.org/t/stdin-stdout-10x-slower-than-file-open/17233)

<div class="topic-metadata">

**Author:** [@peter.derijk](https://discourse.julialang.org/u/peter.derijk)\
**Replies:** 13\
**Last updated:** [November 9, 2018, 12:31pm UTC](https://discourse.julialang.org/t/stdin-stdout-10x-slower-than-file-open/17233 "2018-11-09T12:31:35Z")

</div>

I came across a curious problem writing some code converting files. It turned out to be slower than a previously used scripting language, and not approaching (expected) C speed at all. I could get it to approximate C spe…

---

## [Pairwise distance using matrix or Vector{SVector}: The first is faster!](https://discourse.julialang.org/t/pairwise-distance-using-matrix-or-vector-svector-the-first-is-faster/17312)

<div class="topic-metadata">

**Author:** [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Replies:** 4\
**Last updated:** [November 8, 2018, 5:55pm UTC](https://discourse.julialang.org/t/pairwise-distance-using-matrix-or-vector-svector-the-first-is-faster/17312 "2018-11-08T17:55:11Z")

</div>

I am facing a really unexpected result, that is that the pairwise distance computation using a matrix is actually faster than a vector of static vectors, for small dimensions. here is my simple setup: using Distances, S…

---

## [Inlining behavior: constant prop. fails, I need help in understanding "why"](https://discourse.julialang.org/t/inlining-behavior-constant-prop-fails-i-need-help-in-understanding-why/17134)

<div class="topic-metadata">

**Author:** [@Datseris](https://discourse.julialang.org/u/Datseris)\
**Replies:** 9\
**Last updated:** [November 8, 2018, 4:20pm UTC](https://discourse.julialang.org/t/inlining-behavior-constant-prop-fails-i-need-help-in-understanding-why/17134 "2018-11-08T16:20:40Z")

</div>

MWE: using StaticArrays, BenchmarkTools struct DelayEmbedding{D} delays::SVector{D, Int} end @inline DelayEmbedding(D::Int) = DelayEmbedding(Val{D}()) @inline function DelayEmbedding(::Val{D}) where {D} idxs = …

---

## [Is constructing an array on the fly on this line costing me a lot of memory?](https://discourse.julialang.org/t/is-constructing-an-array-on-the-fly-on-this-line-costing-me-a-lot-of-memory/17276)

<div class="topic-metadata">

**Author:** [@SZJX](https://discourse.julialang.org/u/SZJX)\
**Replies:** 9\
**Last updated:** [November 8, 2018, 1:54pm UTC](https://discourse.julialang.org/t/is-constructing-an-array-on-the-fly-on-this-line-costing-me-a-lot-of-memory/17276 "2018-11-08T13:54:58Z")

</div>

One of my functions takes an array of String as an argument. According to my benchmarking results it apparently incurs very high memory usage, sometimes even the highest throughout my whole program under certain conditio…

---

## [When I import Gtk library my code became immaediately slower](https://discourse.julialang.org/t/when-i-import-gtk-library-my-code-became-immaediately-slower/17301)

<div class="topic-metadata">

**Author:** [@dsHitman](https://discourse.julialang.org/u/dsHitman)\
**Replies:** 2\
**Last updated:** [November 8, 2018, 10:42am UTC](https://discourse.julialang.org/t/when-i-import-gtk-library-my-code-became-immaediately-slower/17301 "2018-11-08T10:42:12Z")

</div>

Hi, I have created a GUI whit Gtk, but it was so slowly. To make a test I have import the Gtk library (using Gtk) in a code, without using it, and the code immediately went slower. Anyone have an idea on why?

---

## [Any way to load a module faster even in a fresh session (given the module has been loaded in a previous sessoin)?](https://discourse.julialang.org/t/any-way-to-load-a-module-faster-even-in-a-fresh-session-given-the-module-has-been-loaded-in-a-previous-sessoin/17230)

<div class="topic-metadata">

**Author:** [@Zhong\_Pan](https://discourse.julialang.org/u/Zhong_Pan)\
**Replies:** 2\
**Last updated:** [November 7, 2018, 1:52am UTC](https://discourse.julialang.org/t/any-way-to-load-a-module-faster-even-in-a-fresh-session-given-the-module-has-been-loaded-in-a-previous-sessoin/17230 "2018-11-07T01:52:08Z")

</div>

I know that first time a module is loaded in a new session, Julia needs to go through a lot of compiling so it’s slow, and successive loads are much faster. But I read that recent versions of Julia will pre-compile modul…

---

## [Warning for array view usage?](https://discourse.julialang.org/t/warning-for-array-view-usage/17189)

<div class="topic-metadata">

**Author:** [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Replies:** 13\
**Last updated:** [November 6, 2018, 10:25pm UTC](https://discourse.julialang.org/t/warning-for-array-view-usage/17189 "2018-11-06T22:25:13Z")

</div>

Dear Julia experts, I have been struggling a few hours to understand a massive slow down (x1000) of some computations. I finally spotted the problem to be caused by the use of array views in a context where one (at leas…

---

## [Loading lots of images](https://discourse.julialang.org/t/loading-lots-of-images/17125)

<div class="topic-metadata">

**Author:** [@robertdj](https://discourse.julialang.org/u/robertdj)\
**Replies:** 5\
**Last updated:** [November 5, 2018, 7:59pm UTC](https://discourse.julialang.org/t/loading-lots-of-images/17125 "2018-11-05T19:59:57Z")

</div>

I have a lot of folders, each with a lot of images. All images have the same size. I want to compute the “average image” of each folder, that is, the pixel-wise average of the images in the folder. With the Images pack…

---

## [How is factorial(BigInt) so fast?](https://discourse.julialang.org/t/how-is-factorial-bigint-so-fast/17166)

<div class="topic-metadata">

**Author:** [@frank](https://discourse.julialang.org/u/frank)\
**Replies:** 10\
**Last updated:** [November 5, 2018, 4:32pm UTC](https://discourse.julialang.org/t/how-is-factorial-bigint-so-fast/17166 "2018-11-05T16:32:47Z")

</div>

As an experiment, I copy/pasted Julia’s factorial() function and renamed it. But when I use it to evaluate a bigint, it is way slower than Julia’s factorial(BigInt). If the base function uses the same code, then why is …

---

## [Enumerate loop: problem with indexing (method error)](https://discourse.julialang.org/t/enumerate-loop-problem-with-indexing-method-error/17168)

<div class="topic-metadata">

**Author:** [@axelle](https://discourse.julialang.org/u/axelle)\
**Replies:** 3\
**Last updated:** [November 5, 2018, 2:53pm UTC](https://discourse.julialang.org/t/enumerate-loop-problem-with-indexing-method-error/17168 "2018-11-05T14:53:56Z")

</div>

Good afternoon, Using an enumerate loop, I get an error method when trying to fill in a vector with value calculated at each iteration of the loop. Would anyone know how to solve it? Many thanks for your help. grid = c…

---

## [Return type of blockdiag?](https://discourse.julialang.org/t/return-type-of-blockdiag/17172)

<div class="topic-metadata">

**Author:** [@teored90](https://discourse.julialang.org/u/teored90)\
**Replies:** 1\
**Last updated:** [November 5, 2018, 2:43pm UTC](https://discourse.julialang.org/t/return-type-of-blockdiag/17172 "2018-11-05T14:43:46Z")

</div>

I was studying the type stability of my code (I’m still very bad at it) and I bumped into this weird behavior with SparseArrays.blockdiag(): julia\> using SparseArrays julia\> A = \[sprand(100, 100, .1) for i = 1: 15\]; @co…

---

## [Extreme memory usage seemingly caused by using the functions \`map\` and \`Iterators.flatten\`](https://discourse.julialang.org/t/extreme-memory-usage-seemingly-caused-by-using-the-functions-map-and-iterators-flatten/17141)

<div class="topic-metadata">

**Author:** [@SZJX](https://discourse.julialang.org/u/SZJX)\
**Replies:** 2\
**Last updated:** [November 4, 2018, 5:40pm UTC](https://discourse.julialang.org/t/extreme-memory-usage-seemingly-caused-by-using-the-functions-map-and-iterators-flatten/17141 "2018-11-04T17:40:24Z")

</div>

I had a program that was running extremely slowly so I ran memory benchmark on it. Apparently one particular line of code accumulated a whopping 27GB of memory allocation… (lgamma(theta(pyp)) - lgamma(theta(pyp)…

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

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