# Performance

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

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

**Page:** 135

---

## [Modifying a sparse matrix non-zero indices](https://discourse.julialang.org/t/modifying-a-sparse-matrix-non-zero-indices/18950)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 1\
**Last updated:** [December 25, 2018, 1:30am UTC](https://discourse.julialang.org/t/modifying-a-sparse-matrix-non-zero-indices/18950 "2018-12-25T01:30:07Z")

</div>

I’m working in a problem where I have a sparse Jacobian matrix with 16 values in each row. I would like to update the matrix by just modifying its non-zero values. The problem is I would like to update both the non-zero …

---

## [TerminalExtensions.jl + iterm2](https://discourse.julialang.org/t/terminalextensions-jl-iterm2/18927)

<div class="topic-metadata">

**Author:** [@monty](https://discourse.julialang.org/u/monty)\
**Replies:** 2\
**Last updated:** [December 24, 2018, 10:00pm UTC](https://discourse.julialang.org/t/terminalextensions-jl-iterm2/18927 "2018-12-24T22:00:57Z")

</div>

TerminalExtensions.jl + iterm2 work nicely under 0.6.4 to visualize Gadfly and Plots.jl plots. using TerminalExtensions, Gadfly, Plots Plots.plot(1:10) Gadfly.plot(x=1:10) commands above generate figures in the xtem2 t…

---

## [V1.0.3. Type conversion or ceiling division? One line example](https://discourse.julialang.org/t/v1-0-3-type-conversion-or-ceiling-division-one-line-example/18947)

<div class="topic-metadata">

**Author:** [@xanfus](https://discourse.julialang.org/u/xanfus)\
**Replies:** 0\
**Last updated:** [December 23, 2018, 6:03pm UTC](https://discourse.julialang.org/t/v1-0-3-type-conversion-or-ceiling-division-one-line-example/18947 "2018-12-23T18:03:34Z")

</div>

The last line executes pretty fast in global space. pids=2:13;NN=138000;NN1=18000;NN2=120000;zTop1x=1.0;hLay2=0.2; zut=SharedArray{Float64}(NN, init = S -\> S\[localindices(S)\] .= 0.0,pids=pids) TD2=SharedArray{Int64}( N…

---

## [empty matrix creation](https://discourse.julialang.org/t/empty-matrix-creation/18910)

<div class="topic-metadata">

**Author:** [@kehlert](https://discourse.julialang.org/u/kehlert)\
**Replies:** 2\
**Last updated:** [December 21, 2018, 7:26pm UTC](https://discourse.julialang.org/t/empty-matrix-creation/18910 "2018-12-21T19:26:00Z")

</div>

I am trying to fill a matrix, and currently it takes longer to create it than to fill it. Here is the code for creating it: Array{Int64,2}(undef, 3, 10^3) I profiled it, and it seems to spend all of its time in the Typ…

---

## [Fast fit of generalized pareto distribution](https://discourse.julialang.org/t/fast-fit-of-generalized-pareto-distribution/18774)

<div class="topic-metadata">

**Author:** [@daniel](https://discourse.julialang.org/u/daniel)\
**Replies:** 9\
**Last updated:** [December 18, 2018, 5:31pm UTC](https://discourse.julialang.org/t/fast-fit-of-generalized-pareto-distribution/18774 "2018-12-18T17:31:55Z")

</div>

I’ve implemented a (slightly adapted) julia version of the Generalized Pareto estimation method described in this paper: DOI 10.1198/TECH.2009.08017 Am I missing any obvious performance improvements? Is it correct that …

---

## [Interleaving bits (Z-order curve,morton code).Transpose binary matrix](https://discourse.julialang.org/t/interleaving-bits-z-order-curve-morton-code-transpose-binary-matrix/18458)

<div class="topic-metadata">

**Author:** [@rapasite](https://discourse.julialang.org/u/rapasite)\
**Replies:** 8\
**Last updated:** [December 16, 2018, 1:51pm UTC](https://discourse.julialang.org/t/interleaving-bits-z-order-curve-morton-code-transpose-binary-matrix/18458 "2018-12-16T13:51:35Z")

</div>

Hi I am trying to make the fastest code to UN-interleaving every 4 bits of a UInt64. So if I have the binary representation of my Int as : ABCD/EFGH/IJKL/MNOP/QRST/UVWX (letters are 0 and 1) I am looking for something…

---

## [Sorting lines by ID seems slow](https://discourse.julialang.org/t/sorting-lines-by-id-seems-slow/18705)

<div class="topic-metadata">

**Author:** [@tblz](https://discourse.julialang.org/u/tblz)\
**Replies:** 2\
**Last updated:** [December 16, 2018, 3:18am UTC](https://discourse.julialang.org/t/sorting-lines-by-id-seems-slow/18705 "2018-12-16T03:18:26Z")

</div>

Am trying to sort a file that looks like this: sc285168\_1 # 660 # 1046 # -1 # ID=285168\_1;partial=00; sc29363\_1 # 57 # 887 # 1 # ID=29363\_1;partial=00; sc316197\_1 # 17 # 418 # 1 # ID=316197\_1;partial=00; sc273994\_1 …

---

## [What functions/packages should I use to sort and "group by" as fast as possible...?](https://discourse.julialang.org/t/what-functions-packages-should-i-use-to-sort-and-group-by-as-fast-as-possible/18687)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 4\
**Last updated:** [December 16, 2018, 1:05am UTC](https://discourse.julialang.org/t/what-functions-packages-should-i-use-to-sort-and-group-by-as-fast-as-possible/18687 "2018-12-16T01:05:07Z")

</div>

I’m looking for fast functions to group by or sort large dataframes with several columns of strings (with few different values) or numbers. There are many packages and options: Base, ShortStrings, SortingLab, FastGroupB…

---

## [Reinterpret UInt64 as SVector{8,UInt8}](https://discourse.julialang.org/t/reinterpret-uint64-as-svector-8-uint8/18652)

<div class="topic-metadata">

**Author:** [@zsoerenm](https://discourse.julialang.org/u/zsoerenm)\
**Replies:** 2\
**Last updated:** [December 14, 2018, 11:53am UTC](https://discourse.julialang.org/t/reinterpret-uint64-as-svector-8-uint8/18652 "2018-12-14T11:53:50Z")

</div>

I’d like to reinterpret a UInt64 as a SVector{8, UInt8}: julia\> reinterpret(SVector{8, UInt8}, UInt64(1235189)) ERROR: bitcast: target type not a leaf primitive type Stacktrace: \[1\] reinterpret(::Type{SArray{Tuple{8},U…

---

## [Multiply many-matrices by many-vectors](https://discourse.julialang.org/t/multiply-many-matrices-by-many-vectors/18542)

<div class="topic-metadata">

**Author:** [@GregVernon](https://discourse.julialang.org/u/GregVernon)\
**Replies:** 33\
**Last updated:** [December 14, 2018, 12:44am UTC](https://discourse.julialang.org/t/multiply-many-matrices-by-many-vectors/18542 "2018-12-14T00:44:10Z")

</div>

All, I have a critical portion of code that essentially involves the multiplication of many pre-computed matrices by many pre-computed vectors. Each matrix multiplies the same, entire list of vectors. Each matrix is t…

---

## [An Adventurous Juila Challenge](https://discourse.julialang.org/t/an-adventurous-juila-challenge/18620)

<div class="topic-metadata">

**Author:** [@jzakiya](https://discourse.julialang.org/u/jzakiya)\
**Replies:** 0\
**Last updated:** [December 13, 2018, 3:24am UTC](https://discourse.julialang.org/t/an-adventurous-juila-challenge/18620 "2018-12-13T03:24:52Z")

</div>

Hello, I hope I put this post in the correct category, excuse me if not. I’ve been following Julia sporadically for about two years. When it hit 1.0 I finally installed it on my laptop, but so far haven’t done anything…

---

## [DataFrames operation scales badly](https://discourse.julialang.org/t/dataframes-operation-scales-badly/16223)

<div class="topic-metadata">

**Author:** [@nilshg](https://discourse.julialang.org/u/nilshg)\
**Replies:** 21\
**Last updated:** [December 10, 2018, 8:30pm UTC](https://discourse.julialang.org/t/dataframes-operation-scales-badly/16223 "2018-12-10T20:30:59Z")

</div>

I’m finally making a proper effort to replace my pandas workflows with DataFrames, but currently hitting a massive performance issue which makes me think I’m missing something fundamental. The following snippet of code …

---

## [Reusing Sparsity patterns in sparse matrix products](https://discourse.julialang.org/t/reusing-sparsity-patterns-in-sparse-matrix-products/18443)

<div class="topic-metadata">

**Author:** [@lstagner](https://discourse.julialang.org/u/lstagner)\
**Replies:** 11\
**Last updated:** [December 11, 2018, 12:31am UTC](https://discourse.julialang.org/t/reusing-sparsity-patterns-in-sparse-matrix-products/18443 "2018-12-11T00:31:55Z")

</div>

I have this sparse matrix operation R\*kron(I,C)\*R' where R is a sparse matrix, I is the identity matrix, and C is a dense square matrix. The size of these matrices can be quite large; R is 2000 x 6250000 and the kronecke…

---

## [Reducing allocations to optimize (to match Java speed)](https://discourse.julialang.org/t/reducing-allocations-to-optimize-to-match-java-speed/18448)

<div class="topic-metadata">

**Author:** [@lwhitefox](https://discourse.julialang.org/u/lwhitefox)\
**Replies:** 22\
**Last updated:** [December 10, 2018, 2:41pm UTC](https://discourse.julialang.org/t/reducing-allocations-to-optimize-to-match-java-speed/18448 "2018-12-10T14:41:13Z")

</div>

I designed and implemented a method where the core task is to evaluate some 2D integrals using Gauss-Legendre methods in Julia. For practical reasons, the final code has to be in Java; the translation into Java is about…

---

## [Converting PyObject to a Julia array](https://discourse.julialang.org/t/converting-pyobject-to-a-julia-array/18445)

<div class="topic-metadata">

**Author:** [@monty](https://discourse.julialang.org/u/monty)\
**Replies:** 6\
**Last updated:** [December 9, 2018, 1:36am UTC](https://discourse.julialang.org/t/converting-pyobject-to-a-julia-array/18445 "2018-12-09T01:36:46Z")

</div>

How to convert PyObject into a Julia array import PyCall tf = PyCall.pyimport("tensorflow") o = tf\[:random\_normal\]((3,3)) PyObject \<tf.Tensor: id=27, shape=(3, 3), dtype=float32, numpy= array(\[\[0.02705349, 0.3173014 , 0…

---

## [Right way to "static" allocate vectors in a function](https://discourse.julialang.org/t/right-way-to-static-allocate-vectors-in-a-function/18469)

<div class="topic-metadata">

**Author:** [@Ronis\_BR](https://discourse.julialang.org/u/Ronis_BR)\
**Replies:** 2\
**Last updated:** [December 8, 2018, 8:18pm UTC](https://discourse.julialang.org/t/right-way-to-static-allocate-vectors-in-a-function/18469 "2018-12-08T20:18:47Z")

</div>

Hi guys! I have some functions that were called to fill a 2000 x 2000 matrix. Some functions need to allocate 2000x1 vectors to do the computations. However, those functions are called like 2000x2000 times :sweat\_smile: …

---

## [Eigenvalues of symmetric matrix in packed format (upper triangular entries stacked in vector)](https://discourse.julialang.org/t/eigenvalues-of-symmetric-matrix-in-packed-format-upper-triangular-entries-stacked-in-vector/18323)

<div class="topic-metadata">

**Author:** [@migarstka](https://discourse.julialang.org/u/migarstka)\
**Replies:** 0\
**Last updated:** [December 5, 2018, 2:46pm UTC](https://discourse.julialang.org/t/eigenvalues-of-symmetric-matrix-in-packed-format-upper-triangular-entries-stacked-in-vector/18323 "2018-12-05T14:46:20Z")

</div>

I am trying to compute the eigenvalues of a symmetric matrix in packed format, i.e. you stack the upper triangular entries in a vector (Packed Storage ) It seems like there exists a LAPACK function for that, e.g. spev. …

---

## [Is there a function compute matrix multiplication in a multimensional matrix?](https://discourse.julialang.org/t/is-there-a-function-compute-matrix-multiplication-in-a-multimensional-matrix/18106)

<div class="topic-metadata">

**Author:** [@Dhananjay\_Ghangale](https://discourse.julialang.org/u/Dhananjay_Ghangale)\
**Replies:** 8\
**Last updated:** [December 3, 2018, 4:33pm UTC](https://discourse.julialang.org/t/is-there-a-function-compute-matrix-multiplication-in-a-multimensional-matrix/18106 "2018-12-03T16:33:27Z")

</div>

For matrices of n dimensions and same sizes is there a function that can compute matrix multiplication. for example in matlab there exists a function call mtimesx (MTIMESX - Fast Matrix Multiply with Multi-Dimensional S…

---

## [GPU randn way slower than rand?](https://discourse.julialang.org/t/gpu-randn-way-slower-than-rand/18236)

<div class="topic-metadata">

**Author:** [@Zhiye\_Xia](https://discourse.julialang.org/u/Zhiye_Xia)\
**Replies:** 6\
**Last updated:** [December 3, 2018, 6:53am UTC](https://discourse.julialang.org/t/gpu-randn-way-slower-than-rand/18236 "2018-12-03T06:53:46Z")

</div>

I’m trying to generate random normals directly on GPU when I find the following result: using CuArrays using Random ac = Array{Float64}(undef, 2^20) ag = cu(ac) @time rand!(ac) @time rand!(ag) ac = Array{Float64}(undef,…

---

## [Inexplicable allocations when summing \`StaticArrays\`](https://discourse.julialang.org/t/inexplicable-allocations-when-summing-staticarrays/18012)

<div class="topic-metadata">

**Author:** [@zygmuntszpak](https://discourse.julialang.org/u/zygmuntszpak)\
**Replies:** 8\
**Last updated:** [December 3, 2018, 1:25am UTC](https://discourse.julialang.org/t/inexplicable-allocations-when-summing-staticarrays/18012 "2018-12-03T01:25:08Z")

</div>

This is a cross-post from an issue I opened in the StaticArrays package: https://github.com/JuliaArrays/StaticArrays.jl/issues/537 I have been working on a pull-request to fix an issue I discovered with StaticArrays. I…

---

## [Unexpected memory allocation from @timev?](https://discourse.julialang.org/t/unexpected-memory-allocation-from-timev/18223)

<div class="topic-metadata">

**Author:** [@drmartinrohde](https://discourse.julialang.org/u/drmartinrohde)\
**Replies:** 5\
**Last updated:** [December 2, 2018, 6:29pm UTC](https://discourse.julialang.org/t/unexpected-memory-allocation-from-timev/18223 "2018-12-02T18:29:41Z")

</div>

I have written a piece of code consisting of hundreds of lines. Everything is defined in functions. When running this code, I basically calculate a temperature profile along a loop in time. After running this code and ch…

---

## [Julia is slow questions - how to request information](https://discourse.julialang.org/t/julia-is-slow-questions-how-to-request-information/17969)

<div class="topic-metadata">

**Author:** [@johnh](https://discourse.julialang.org/u/johnh)\
**Replies:** 10\
**Last updated:** [November 30, 2018, 7:23pm UTC](https://discourse.julialang.org/t/julia-is-slow-questions-how-to-request-information/17969 "2018-11-30T19:23:48Z")

</div>

As the Julia language grows we will see more ‘Julia is slow when I do XYZ’ questions. For instance I have seen several discussions recently about ‘slowness’ when reading in data. We cannot have hard and fast rules for de…

---

## [Can Julia Optimize an array expression?](https://discourse.julialang.org/t/can-julia-optimize-an-array-expression/18182)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 2\
**Last updated:** [November 30, 2018, 2:12pm UTC](https://discourse.julialang.org/t/can-julia-optimize-an-array-expression/18182 "2018-11-30T14:12:38Z")

</div>

Suppose I write a function that operates over (simple) arrays, even just taking floats as an input to construct the array, can Julia optimize the whole thing into a simple expression? function f(a::Float64,b::Float64) …

---

## [Fortran vs Julia stack allocated arrays](https://discourse.julialang.org/t/fortran-vs-julia-stack-allocated-arrays/18119)

<div class="topic-metadata">

**Author:** [@datnamer](https://discourse.julialang.org/u/datnamer)\
**Replies:** 18\
**Last updated:** [November 29, 2018, 5:17pm UTC](https://discourse.julialang.org/t/fortran-vs-julia-stack-allocated-arrays/18119 "2018-11-29T17:17:32Z")

</div>

I ran into the following HN comment: But to say something nice about Fortran: dynamically-sized-mutable-stack-allocated-arrays. (-fstack-arrays) In Julia, stack-allocated objects are immutable, and (partly for that …

---

## [Memoization of functions with vector inputs in Julia and JuMP](https://discourse.julialang.org/t/memoization-of-functions-with-vector-inputs-in-julia-and-jump/18143)

<div class="topic-metadata">

**Author:** [@Olegg](https://discourse.julialang.org/u/Olegg)\
**Replies:** 0\
**Last updated:** [November 29, 2018, 3:30pm UTC](https://discourse.julialang.org/t/memoization-of-functions-with-vector-inputs-in-julia-and-jump/18143 "2018-11-29T15:30:14Z")

</div>

I’m evaluating the trade-offs and efficient use of memoization with lengthy vectors, particularly in optimisation. Suppose a vector input to an expensive function has many Float64 elements, say, 100,000. When this functi…

---

## [Achieving C++ Speeds for a CFD Algorithm: Julia spends too much time on pre-allocation?](https://discourse.julialang.org/t/achieving-c-speeds-for-a-cfd-algorithm-julia-spends-too-much-time-on-pre-allocation/17410)

<div class="topic-metadata">

**Author:** [@EmadMasroor](https://discourse.julialang.org/u/EmadMasroor)\
**Replies:** 22\
**Last updated:** [November 28, 2018, 6:14am UTC](https://discourse.julialang.org/t/achieving-c-speeds-for-a-cfd-algorithm-julia-spends-too-much-time-on-pre-allocation/17410 "2018-11-28T06:14:18Z")

</div>

I have a CFD Algorithm that I implemented first in MATLAB (slow), then in C++ (blazing fast), and now I am trying to recreate it in Julia. I have already achieved much faster performance than MATLAB but there seem to be …

---

## [Sparse array problem: is this a known bug?](https://discourse.julialang.org/t/sparse-array-problem-is-this-a-known-bug/18032)

<div class="topic-metadata">

**Author:** [@PeterB](https://discourse.julialang.org/u/PeterB)\
**Replies:** 6\
**Last updated:** [November 27, 2018, 1:49am UTC](https://discourse.julialang.org/t/sparse-array-problem-is-this-a-known-bug/18032 "2018-11-27T01:49:27Z")

</div>

I accidentally downloaded version 1.1.0-DEV.699 , and I think I discovered a bug with sparse arrays. So (a) is this a bug, (b) is it known by the developers, and (c) if so, where do I report it. (and (d), and I am the co…

---

## [GLM is slow on large datasets. Using OnlineStats for regressions? MixedModels?](https://discourse.julialang.org/t/glm-is-slow-on-large-datasets-using-onlinestats-for-regressions-mixedmodels/17695)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 25\
**Last updated:** [November 26, 2018, 5:54pm UTC](https://discourse.julialang.org/t/glm-is-slow-on-large-datasets-using-onlinestats-for-regressions-mixedmodels/17695 "2018-11-26T17:54:17Z")

</div>

Hello. I’m planning to move from R to Julia and doing some tests about how to properly deal with large datasets and do simple tasks like regressions or survival analysis. I’ve done a benchmark with R (microbenchmark) f…

---

## [Behavior of worker pool in pmap](https://discourse.julialang.org/t/behavior-of-worker-pool-in-pmap/17882)

<div class="topic-metadata">

**Author:** [@swishmas](https://discourse.julialang.org/u/swishmas)\
**Replies:** 2\
**Last updated:** [November 25, 2018, 6:39pm UTC](https://discourse.julialang.org/t/behavior-of-worker-pool-in-pmap/17882 "2018-11-25T18:39:34Z")

</div>

Hi everyone, I’ve been coding in julia for a while, but I haven’t used any of the parallelization features beyond the Distributed package. My experience with parallelization is mainly with OpenMP in Fortran. I wanted to…

---

## [Compilation performance. Branching](https://discourse.julialang.org/t/compilation-performance-branching/17973)

<div class="topic-metadata">

**Author:** [@xanfus](https://discourse.julialang.org/u/xanfus)\
**Replies:** 3\
**Last updated:** [November 25, 2018, 1:13pm UTC](https://discourse.julialang.org/t/compilation-performance-branching/17973 "2018-11-25T13:13:17Z")

</div>

My physical model consists of results requested, test subjects and variable set of phenomena acting upon the subjects. It’s convenient to keep all phenomena-related function calls conditioned by if-else statements within…

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

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