# Performance

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

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

**Page:** 122

---

## [Cumsum behaviour on sparse arrays](https://discourse.julialang.org/t/cumsum-behaviour-on-sparse-arrays/33886)

<div class="topic-metadata">

**Author:** [@mlanghinrichs](https://discourse.julialang.org/u/mlanghinrichs)\
**Replies:** 3\
**Last updated:** [January 28, 2020, 8:15pm UTC](https://discourse.julialang.org/t/cumsum-behaviour-on-sparse-arrays/33886 "2020-01-28T20:15:11Z")

</div>

Hi there, I’m rather new to Julia (and already enjoying it a lot), so please don’t be too hard on me if my topic doesn’t make that much sense. However I think I noticed a somewhat surprising behaviour when cumsum (cumul…

---

## [CSV.jl's CSV write seems slow](https://discourse.julialang.org/t/csv-jls-csv-write-seems-slow/7643)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 32\
**Last updated:** [January 28, 2020, 7:09pm UTC](https://discourse.julialang.org/t/csv-jls-csv-write-seems-slow/7643 "2020-01-28T19:09:04Z")

</div>

updated code with suggestions by ScottPJones The below took about 100~200 seconds but in R’s data.table’s fwrite the same is done in 2 seconds. It is quite a big discrepancy. I am curious as to what need to change befo…

---

## [Question about Functors](https://discourse.julialang.org/t/question-about-functors/33876)

<div class="topic-metadata">

**Author:** [@tbeason](https://discourse.julialang.org/u/tbeason)\
**Replies:** 7\
**Last updated:** [January 28, 2020, 4:41pm UTC](https://discourse.julialang.org/t/question-about-functors/33876 "2020-01-28T16:41:44Z")

</div>

I am trying to solve an economic model. The algorithm involves an iterative two-step procedure, like a back-and-forth optimization. There are lots of inputs and moving parts. I created a struct to keep track of it all. W…

---

## [Unexpected behaviour while benchmarking](https://discourse.julialang.org/t/unexpected-behaviour-while-benchmarking/33890)

<div class="topic-metadata">

**Author:** [@Kruxigt](https://discourse.julialang.org/u/Kruxigt)\
**Replies:** 1\
**Last updated:** [January 28, 2020, 4:31pm UTC](https://discourse.julialang.org/t/unexpected-behaviour-while-benchmarking/33890 "2020-01-28T16:31:16Z")

</div>

Hi fine folks! While investigating improvements for another topic i just posted about here I ran into some unexpected behaviour while benchmarking the code with BenchmarkTools. I have a function rolling\_optima which I …

---

## [Extract relevant lines from large file using IDs from other file](https://discourse.julialang.org/t/extract-relevant-lines-from-large-file-using-ids-from-other-file/33859)

<div class="topic-metadata">

**Author:** [@swuyts](https://discourse.julialang.org/u/swuyts)\
**Replies:** 10\
**Last updated:** [January 27, 2020, 11:35pm UTC](https://discourse.julialang.org/t/extract-relevant-lines-from-large-file-using-ids-from-other-file/33859 "2020-01-27T23:35:02Z")

</div>

Hi there, I am new to Julia but interested to learn. I would like to extract lines from a large file (32gb; File B) based on an ID (File A) that is stored in another file. \> FileA ID01 ID02 ID03 ... IDXX \> FileB ID05…

---

## [Memory consumtion Rational{BigInt} on bernoulli number example](https://discourse.julialang.org/t/memory-consumtion-rational-bigint-on-bernoulli-number-example/33812)

<div class="topic-metadata">

**Author:** [@mwolff](https://discourse.julialang.org/u/mwolff)\
**Replies:** 14\
**Last updated:** [January 27, 2020, 1:51pm UTC](https://discourse.julialang.org/t/memory-consumtion-rational-bigint-on-bernoulli-number-example/33812 "2020-01-27T13:51:43Z")

</div>

I got a little bored yesterday and tried some examples from rosettacode http://rosettacode.org/wiki/Bernoulli\_numbers#Julia to test the performance against the Python code. Was kind of disappointing, Python worked better…

---

## [Running several Julia engines](https://discourse.julialang.org/t/running-several-julia-engines/33094)

<div class="topic-metadata">

**Author:** [@tanya](https://discourse.julialang.org/u/tanya)\
**Replies:** 6\
**Last updated:** [January 27, 2020, 11:00am UTC](https://discourse.julialang.org/t/running-several-julia-engines/33094 "2020-01-27T11:00:34Z")

</div>

Not sure I am using correct terms/language to describe the problem, but I will try. I want to run several Julia processes on one PC (Monte Carlo simulations). When I do it in Matlab, I simply start several Labs, and the…

---

## [Example C vs Julia vs Python](https://discourse.julialang.org/t/example-c-vs-julia-vs-python/33120)

<div class="topic-metadata">

**Author:** [@jleman](https://discourse.julialang.org/u/jleman)\
**Replies:** 41\
**Last updated:** [January 23, 2020, 6:44am UTC](https://discourse.julialang.org/t/example-c-vs-julia-vs-python/33120 "2020-01-23T06:44:52Z")

</div>

I have been using Julia for about a year. I am an EE, not a programmer. In one of my graduate EE courses I requested to use Julia instead of C for an assignment and got the task of comparing performance of C, Julia, an…

---

## [Performance bug when creating a sparse matrix via Python](https://discourse.julialang.org/t/performance-bug-when-creating-a-sparse-matrix-via-python/33661)

<div class="topic-metadata">

**Author:** [@TomDeWeer](https://discourse.julialang.org/u/TomDeWeer)\
**Replies:** 3\
**Last updated:** [January 22, 2020, 7:05pm UTC](https://discourse.julialang.org/t/performance-bug-when-creating-a-sparse-matrix-via-python/33661 "2020-01-22T19:05:22Z")

</div>

Hi all, I am trying to solve Ax=B for a sparse A in Julia. I create the A and B matrix in Python and import it into Julia via the PyCall package.The problem is that this import takes ages and consumes all my RAM. I beli…

---

## [Allocations on threaded prefix algorithm](https://discourse.julialang.org/t/allocations-on-threaded-prefix-algorithm/33631)

<div class="topic-metadata">

**Author:** [@squirrel](https://discourse.julialang.org/u/squirrel)\
**Replies:** 0\
**Last updated:** [January 21, 2020, 6:10pm UTC](https://discourse.julialang.org/t/allocations-on-threaded-prefix-algorithm/33631 "2020-01-21T18:10:43Z")

</div>

I’m going through the Parallel Computing course at juliaacademy.com. They give this example of a prefix code being rewritten in parallel. However, the video does not go through it, and when I run it on my own, I get a lo…

---

## [Parallelizaton on GPU slower than on CPU...?](https://discourse.julialang.org/t/parallelizaton-on-gpu-slower-than-on-cpu/33587)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 10\
**Last updated:** [January 21, 2020, 2:54pm UTC](https://discourse.julialang.org/t/parallelizaton-on-gpu-slower-than-on-cpu/33587 "2020-01-21T14:54:51Z")

</div>

I built a new PC and I’ve been toying around with some code just to see how it performs and I’m trying to understand why the following code (from the CUDA.jl docs) runs slower on my GPU than on my CPU (I have a Ryzen 9 3…

---

## [How to setup Julia workers to use specific number of cores?](https://discourse.julialang.org/t/how-to-setup-julia-workers-to-use-specific-number-of-cores/33597)

<div class="topic-metadata">

**Author:** [@indycdrom](https://discourse.julialang.org/u/indycdrom)\
**Replies:** 5\
**Last updated:** [January 21, 2020, 11:05am UTC](https://discourse.julialang.org/t/how-to-setup-julia-workers-to-use-specific-number-of-cores/33597 "2020-01-21T11:05:27Z")

</div>

I am a beginner, so I am trying my best to describe my issue as clearly as possible. I installed julia 1.2.0 in a windows 2012 with 2 CPU/socket (22 cores in each CPU) and 512GB RAM. I am wondering whether I can start …

---

## [BaseBenchmarks.jl not in registry?](https://discourse.julialang.org/t/basebenchmarks-jl-not-in-registry/33557)

<div class="topic-metadata">

**Author:** [@mthelm85](https://discourse.julialang.org/u/mthelm85)\
**Replies:** 1\
**Last updated:** [January 19, 2020, 7:59pm UTC](https://discourse.julialang.org/t/basebenchmarks-jl-not-in-registry/33557 "2020-01-19T19:59:11Z")

</div>

When I try to add this package, I get the following error: (v1.3) pkg\> add BaseBenchmarks ERROR: The following package names could not be resolved: \* BaseBenchmarks (not found in project, manifest or registry) Please s…

---

## [Performance advice needed](https://discourse.julialang.org/t/performance-advice-needed/33467)

<div class="topic-metadata">

**Author:** [@Jakub\_Wronowski](https://discourse.julialang.org/u/Jakub_Wronowski)\
**Replies:** 17\
**Last updated:** [January 17, 2020, 5:55pm UTC](https://discourse.julialang.org/t/performance-advice-needed/33467 "2020-01-17T17:55:02Z")

</div>

Hi, I am working on a function with calculation that have structure similar to FFT. I’m a bit disappointed, cause I hoped it will be 10x slower than FFTW but benchmarks show its 100x slower. i tried to put @simd and @in…

---

## [Question about optimal thread allocation for vector of problems of differing sizes](https://discourse.julialang.org/t/question-about-optimal-thread-allocation-for-vector-of-problems-of-differing-sizes/33464)

<div class="topic-metadata">

**Author:** [@Sean\_Matthews](https://discourse.julialang.org/u/Sean_Matthews)\
**Replies:** 7\
**Last updated:** [January 17, 2020, 11:09pm UTC](https://discourse.julialang.org/t/question-about-optimal-thread-allocation-for-vector-of-problems-of-differing-sizes/33464 "2020-01-17T23:09:15Z")

</div>

I have a question about multithreading. I have a vector of pairwise thread safe problems v, say of length 16, and I have four threads. As I understand it, if I write Threads.@theads for i in 1:16 do\_problem(v\[i\]) en…

---

## [Core.tuple() warntype](https://discourse.julialang.org/t/core-tuple-warntype/33375)

<div class="topic-metadata">

**Author:** [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Replies:** 22\
**Last updated:** [January 17, 2020, 7:33pm UTC](https://discourse.julialang.org/t/core-tuple-warntype/33375 "2020-01-17T19:33:29Z")

</div>

I’m studying Tuples and find that (in base/tuple.jl) a lot of methods to create them (e.g. map(), NTuple{}(), etc.) at the end would return something like (x..., ), which calls Core.tuple(). However, I found that this c…

---

## [Packed struct](https://discourse.julialang.org/t/packed-struct/33394)

<div class="topic-metadata">

**Author:** [@garychow](https://discourse.julialang.org/u/garychow)\
**Replies:** 2\
**Last updated:** [January 16, 2020, 11:16am UTC](https://discourse.julialang.org/t/packed-struct/33394 "2020-01-16T11:16:29Z")

</div>

Hi, I have some binary data which I would like to unpack to some struct. However, as far as I know julia does not support the packed (ie non aligned without padding) struct and that make it impossible to use unsafe\_wrap…

---

## [Concatenating iterables without allocating memory](https://discourse.julialang.org/t/concatenating-iterables-without-allocating-memory/33282)

<div class="topic-metadata">

**Author:** [@Jakub\_Wronowski](https://discourse.julialang.org/u/Jakub_Wronowski)\
**Replies:** 34\
**Last updated:** [January 16, 2020, 4:06am UTC](https://discourse.julialang.org/t/concatenating-iterables-without-allocating-memory/33282 "2020-01-16T04:06:57Z")

</div>

Hi, for a library I am working now I need to find minimum and maximum values. I am looking elegant way to express that. signal1 = rand(10000000) signal2 = rand(10000000) @time lo, hi = extrema(vcat(signal1, signal2)) …

---

## [Implementation of Norvigs spellchecker (Code critique + performance help)](https://discourse.julialang.org/t/implementation-of-norvigs-spellchecker-code-critique-performance-help/33038)

<div class="topic-metadata">

**Author:** [@dunefox](https://discourse.julialang.org/u/dunefox)\
**Replies:** 21\
**Last updated:** [January 14, 2020, 8:21pm UTC](https://discourse.julialang.org/t/implementation-of-norvigs-spellchecker-code-critique-performance-help/33038 "2020-01-14T20:21:34Z")

</div>

I know python relatively well and wanted to learn Julia, so for my first steps I tried to implement Norvigs spellchecker (How to Write a Spelling Corrector). It’s working as intended and I kept it as close as possible bu…

---

## [Solution of underdetermined systems using LAPACK](https://discourse.julialang.org/t/solution-of-underdetermined-systems-using-lapack/33000)

<div class="topic-metadata">

**Author:** [@lucas711642](https://discourse.julialang.org/u/lucas711642)\
**Replies:** 9\
**Last updated:** [January 14, 2020, 9:19am UTC](https://discourse.julialang.org/t/solution-of-underdetermined-systems-using-lapack/33000 "2020-01-14T09:19:12Z")

</div>

I need to get any solution of a bunch of underdetermined systems A\*x = b fastly and cheaply. My first thought is to compute a minimum norm solution using the LQ decomposition of A (which can be used as workspace to minim…

---

## [Even after PackageCompile, the binary still runs slower than in REPL](https://discourse.julialang.org/t/even-after-packagecompile-the-binary-still-runs-slower-than-in-repl/33165)

<div class="topic-metadata">

**Author:** [@cuchxq](https://discourse.julialang.org/u/cuchxq)\
**Replies:** 11\
**Last updated:** [January 13, 2020, 4:35pm UTC](https://discourse.julialang.org/t/even-after-packagecompile-the-binary-still-runs-slower-than-in-repl/33165 "2020-01-13T16:35:23Z")

</div>

I am trying to find a way to finally deploy the program I have written in Julia. And having a binary seems to be the way to go, since I don’t expect the user to have Julia installed. So I use PackageCompiler.jl. I compi…

---

## [How to optimize the following code?](https://discourse.julialang.org/t/how-to-optimize-the-following-code/33209)

<div class="topic-metadata">

**Author:** [@Iulian.Cioarca](https://discourse.julialang.org/u/Iulian.Cioarca)\
**Replies:** 7\
**Last updated:** [January 11, 2020, 11:55pm UTC](https://discourse.julialang.org/t/how-to-optimize-the-following-code/33209 "2020-01-11T23:55:35Z")

</div>

I recently watched this video which ended in a comparison between Python+Numba vs Julia (starting around 1h:06m): The author used multithreading to run the same function 10\_000 times and concluded that Juli…

---

## [How to speed up \`Statistics.median\` along a given dimension?](https://discourse.julialang.org/t/how-to-speed-up-statistics-median-along-a-given-dimension/33220)

<div class="topic-metadata">

**Author:** [@bensetterholm](https://discourse.julialang.org/u/bensetterholm)\
**Replies:** 9\
**Last updated:** [January 11, 2020, 9:06pm UTC](https://discourse.julialang.org/t/how-to-speed-up-statistics-median-along-a-given-dimension/33220 "2020-01-11T21:06:51Z")

</div>

I am in the process of translating a Python function into Julia. I was expecting the latter to be faster than the former, but to my surprise the Python function outperformed my Julia version each time. Using the Profil…

---

## [Output type of binary operations involving StaticArrays](https://discourse.julialang.org/t/output-type-of-binary-operations-involving-staticarrays/33187)

<div class="topic-metadata">

**Author:** [@tomtom](https://discourse.julialang.org/u/tomtom)\
**Replies:** 11\
**Last updated:** [January 11, 2020, 10:38am UTC](https://discourse.julialang.org/t/output-type-of-binary-operations-involving-staticarrays/33187 "2020-01-11T10:38:21Z")

</div>

binary operations on a StaticArray and Array give outputs with quite-inconsistent types. For example, intuitively SVector .+ Vector should give a SVector rather than a Vector? julia\> using StaticArrays julia\> typeof(SV…

---

## [For loop Performance](https://discourse.julialang.org/t/for-loop-performance/33214)

<div class="topic-metadata">

**Author:** [@sam1988](https://discourse.julialang.org/u/sam1988)\
**Replies:** 8\
**Last updated:** [January 11, 2020, 12:16am UTC](https://discourse.julialang.org/t/for-loop-performance/33214 "2020-01-11T00:16:33Z")

</div>

Can somebody help me in speeding up following function function mean\_loop(p::AbstractArray,q::AbstractArray) a = p; a1 = q; z=0.0; for i in 1:length(a1) s=0.0; @inbounds s= mean(a .\> a1\[i\]); z+= s; s=0.0 end r…

---

## [Performance Tips for Combinatorial Problem](https://discourse.julialang.org/t/performance-tips-for-combinatorial-problem/32208)

<div class="topic-metadata">

**Author:** [@jmcastro2109](https://discourse.julialang.org/u/jmcastro2109)\
**Replies:** 16\
**Last updated:** [January 10, 2020, 5:50pm UTC](https://discourse.julialang.org/t/performance-tips-for-combinatorial-problem/32208 "2020-01-10T17:50:43Z")

</div>

Hello! I have a combinatorial discrete choice problem that I solve by Backward Induction. The problem seems to be intensive in both memory and computation time and I would be super happy to improve it on any of these two…

---

## [Type instability of getfield()](https://discourse.julialang.org/t/type-instability-of-getfield/33205)

<div class="topic-metadata">

**Author:** [@HenriDeh](https://discourse.julialang.org/u/HenriDeh)\
**Replies:** 5\
**Last updated:** [January 10, 2020, 5:10pm UTC](https://discourse.julialang.org/t/type-instability-of-getfield/33205 "2020-01-10T17:10:17Z")

</div>

See the following example julia\> struct Bar{T\<:Real} x::T end julia\> struct Foo{T \<: Real} bars::Array{Bar{T},1} end julia\> foo = Foo(fill(Bar(rand()),2)) Foo{Float64}(Bar{Float64}\[Bar{Floa…

---

## [Are the entries in a vector of immutable structs stored in place, or is there always a pointer to the heap?](https://discourse.julialang.org/t/are-the-entries-in-a-vector-of-immutable-structs-stored-in-place-or-is-there-always-a-pointer-to-the-heap/33141)

<div class="topic-metadata">

**Author:** [@Sean\_Matthews](https://discourse.julialang.org/u/Sean_Matthews)\
**Replies:** 10\
**Last updated:** [January 9, 2020, 6:06pm UTC](https://discourse.julialang.org/t/are-the-entries-in-a-vector-of-immutable-structs-stored-in-place-or-is-there-always-a-pointer-to-the-heap/33141 "2020-01-09T18:06:04Z")

</div>

Are the entries in a vector of immutable structs stored in place, or is there always a pointer to the heap? (Or how can I get Julia to do something equivalent). I have a question about the interplay between vectors a…

---

## [Type instability in array concatenation](https://discourse.julialang.org/t/type-instability-in-array-concatenation/32951)

<div class="topic-metadata">

**Author:** [@fleecy](https://discourse.julialang.org/u/fleecy)\
**Replies:** 3\
**Last updated:** [January 4, 2020, 10:09am UTC](https://discourse.julialang.org/t/type-instability-in-array-concatenation/32951 "2020-01-04T10:09:21Z")

</div>

I have some simple code to make a left-quaternion multiplication matrix: function L\_q(q::Vector{T}) where {T\<:Real} return \[q\[1\] -q\[2:4\]'; q\[2:4\] q\[1\] \* I + SkewSymmetricMatrix(q\[2:4\])\] end But the problem is that …

---

## [Improve performance of computation graph evaluation](https://discourse.julialang.org/t/improve-performance-of-computation-graph-evaluation/32873)

<div class="topic-metadata">

**Author:** [@DrChainsaw](https://discourse.julialang.org/u/DrChainsaw)\
**Replies:** 5\
**Last updated:** [January 3, 2020, 8:48pm UTC](https://discourse.julialang.org/t/improve-performance-of-computation-graph-evaluation/32873 "2020-01-03T20:48:58Z")

</div>

Hi, NaiveNASlib.jl uses a run-of-the-mill representation of a computation graph composed of AbstractVertex structs where each vertex is associated with an operation (e.g a neural network layer) as well as its input vert…

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

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