# Performance

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

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

**Page:** 131

---

## [Sum of float64 vector gives slightly incorrect answer](https://discourse.julialang.org/t/sum-of-float64-vector-gives-slightly-incorrect-answer/8577)

<div class="topic-metadata">

**Author:** [@GantZA](https://discourse.julialang.org/u/GantZA)\
**Replies:** 44\
**Last updated:** [April 29, 2019, 3:19pm UTC](https://discourse.julialang.org/t/sum-of-float64-vector-gives-slightly-incorrect-answer/8577 "2019-04-29T15:19:07Z")

</div>

I’ve noticed that when I run the following code a = \[0.00694 0.0023 -0.02064 0.01405\] sum(a) but instead of the expected answer of 0.00265 I get 0.0026500000000000013 Normally this wouldn’t be a problem but this is ha…

---

## [Benchmark tools breaks when using "Threads.@threads"?](https://discourse.julialang.org/t/benchmark-tools-breaks-when-using-threads-threads/23605)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 17\
**Last updated:** [April 27, 2019, 10:03pm UTC](https://discourse.julialang.org/t/benchmark-tools-breaks-when-using-threads-threads/23605 "2019-04-27T22:03:14Z")

</div>

Hey guys! I am trying to benchmark a function in a package I made. The package can be found here, https://github.com/AhmedSalih3d/PostSPH.jl, and the function inside of it I am testing is readVtkArray. When I run the fu…

---

## [Unnecessary compilation happening on every call](https://discourse.julialang.org/t/unnecessary-compilation-happening-on-every-call/17558)

<div class="topic-metadata">

**Author:** [@lwabeke](https://discourse.julialang.org/u/lwabeke)\
**Replies:** 15\
**Last updated:** [April 23, 2019, 8:03am UTC](https://discourse.julialang.org/t/unnecessary-compilation-happening-on-every-call/17558 "2019-04-23T08:03:54Z")

</div>

I seem to have a case where the function gets compiled on almost every call. This is annoyingly slow. julia\> notice(logger, "Before call"); qlp\_run() \[2018-11-15 16:13:13 | notice | root\]: Before call \[2018-11-15 16:14:…

---

## [Allow foldr operation for Strings?](https://discourse.julialang.org/t/allow-foldr-operation-for-strings/23343)

<div class="topic-metadata">

**Author:** [@thautwarm](https://discourse.julialang.org/u/thautwarm)\
**Replies:** 3\
**Last updated:** [April 20, 2019, 6:11pm UTC](https://discourse.julialang.org/t/allow-foldr-operation-for-strings/23343 "2019-04-20T18:11:04Z")

</div>

Currently, if users want to achieve foldr on a String, they have to choose one from the alternatives below as their workaround: collect the string and get a char array, and foldr among this array, causing redundant co…

---

## [How to improve performance of simple averaging function](https://discourse.julialang.org/t/how-to-improve-performance-of-simple-averaging-function/23303)

<div class="topic-metadata">

**Author:** [@flibe](https://discourse.julialang.org/u/flibe)\
**Replies:** 4\
**Last updated:** [April 19, 2019, 9:12pm UTC](https://discourse.julialang.org/t/how-to-improve-performance-of-simple-averaging-function/23303 "2019-04-19T21:12:40Z")

</div>

Dear All I have a program that is heavely based on functions like the my\_function! below. Is there a way to further improve speed and reduce memory allocation so as to make my\_function! as efficient as possible? using…

---

## [Is there an easy way to parallelise matrix multiplication?](https://discourse.julialang.org/t/is-there-an-easy-way-to-parallelise-matrix-multiplication/23266)

<div class="topic-metadata">

**Author:** [@boutor2](https://discourse.julialang.org/u/boutor2)\
**Replies:** 8\
**Last updated:** [April 19, 2019, 8:53am UTC](https://discourse.julialang.org/t/is-there-an-easy-way-to-parallelise-matrix-multiplication/23266 "2019-04-19T08:53:34Z")

</div>

Hi, I am working with large sparse matrices (10^5 x 10^5). I would like to make full use of the cores / threads of my CPU to accelerate the multiplication process. As of now, I am using mul!: using SparseArrays,LinearA…

---

## [Is there any efficient way to generating the non-associative binary products ?](https://discourse.julialang.org/t/is-there-any-efficient-way-to-generating-the-non-associative-binary-products/23255)

<div class="topic-metadata">

**Author:** [@gangchern](https://discourse.julialang.org/u/gangchern)\
**Replies:** 2\
**Last updated:** [April 17, 2019, 8:36pm UTC](https://discourse.julialang.org/t/is-there-any-efficient-way-to-generating-the-non-associative-binary-products/23255 "2019-04-17T20:36:54Z")

</div>

I want to generate all the non-associative product for any ordered list. The code is following struct X\<: Number first second function X(a,b) new(a,b) end end function XProduct(TL::Vector) if length(TL)\>1 h=vc…

---

## [Confused about performance interaction between @view and logical (Boolean) indexing](https://discourse.julialang.org/t/confused-about-performance-interaction-between-view-and-logical-boolean-indexing/23120)

<div class="topic-metadata">

**Author:** [@pmags](https://discourse.julialang.org/u/pmags)\
**Replies:** 7\
**Last updated:** [April 15, 2019, 3:28pm UTC](https://discourse.julialang.org/t/confused-about-performance-interaction-between-view-and-logical-boolean-indexing/23120 "2019-04-15T15:28:40Z")

</div>

I’m trying to understand the interaction between array views and Boolean indexing. In general, my understanding (and experience thus far) is that views generally increasing performance when you’re not modifying the arra…

---

## [Cyclic pair iterator?](https://discourse.julialang.org/t/cyclic-pair-iterator/23156)

<div class="topic-metadata">

**Author:** [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Replies:** 4\
**Last updated:** [April 15, 2019, 3:18pm UTC](https://discourse.julialang.org/t/cyclic-pair-iterator/23156 "2019-04-15T15:18:27Z")

</div>

Hi, I am not very familiar with iterators, so maybe someone can give me some hints. I would like to build a consecutive pairs iterator that would take a collection C and return an iterator over the consecutive pairs. …

---

## [Function created by factory function](https://discourse.julialang.org/t/function-created-by-factory-function/23154)

<div class="topic-metadata">

**Author:** [@asprionj](https://discourse.julialang.org/u/asprionj)\
**Replies:** 3\
**Last updated:** [April 15, 2019, 8:13am UTC](https://discourse.julialang.org/t/function-created-by-factory-function/23154 "2019-04-15T08:13:59Z")

</div>

I have a type of which I want to create specific instances. To illustrate why I want this, think of a Car with fields model::String, year::Int, acceleration::Function. So there’s some “identifier” fields, some “parameter…

---

## [Copy and collect slow on QRCompactWYQ](https://discourse.julialang.org/t/copy-and-collect-slow-on-qrcompactwyq/23145)

<div class="topic-metadata">

**Author:** [@danspielman](https://discourse.julialang.org/u/danspielman)\
**Replies:** 1\
**Last updated:** [April 14, 2019, 9:47pm UTC](https://discourse.julialang.org/t/copy-and-collect-slow-on-qrcompactwyq/23145 "2019-04-14T21:47:31Z")

</div>

The functions copy and collect are extremely slow on the results of a QR factorization. Matrix produces the same result, but is much faster. An easy solution is to not use copy or collect. Is there a good reason for t…

---

## [Help me on strange performance slow down using SMatrix](https://discourse.julialang.org/t/help-me-on-strange-performance-slow-down-using-smatrix/23027)

<div class="topic-metadata">

**Author:** [@Roger-luo](https://discourse.julialang.org/u/Roger-luo)\
**Replies:** 2\
**Last updated:** [April 11, 2019, 7:00pm UTC](https://discourse.julialang.org/t/help-me-on-strange-performance-slow-down-using-smatrix/23027 "2019-04-11T19:00:29Z")

</div>

function instruct2!(state, U, loc) a, c, b, d = U step = 1 \<\< (loc - 1) step\_2 = 1 \<\< loc for j in 0:step\_2:size(state, 1)-step for i in j+1:j+step u1rows!(state, i, i+step, a, b, c, d)…

---

## [Multiplication after transpose much faster than multiplication after PermutedDimsArray](https://discourse.julialang.org/t/multiplication-after-transpose-much-faster-than-multiplication-after-permuteddimsarray/22997)

<div class="topic-metadata">

**Author:** [@tomohiro\_soejima](https://discourse.julialang.org/u/tomohiro_soejima)\
**Replies:** 3\
**Last updated:** [April 10, 2019, 7:45pm UTC](https://discourse.julialang.org/t/multiplication-after-transpose-much-faster-than-multiplication-after-permuteddimsarray/22997 "2019-04-10T19:45:55Z")

</div>

I have been experimenting with matrix multiplication with transpose or PermutedDimsArray functions. My goal was to find the cost for multiplying a transposed array, and I encountered a behavior of transpose I cannot expl…

---

## [Passing sub-array by reference / performance](https://discourse.julialang.org/t/passing-sub-array-by-reference-performance/22978)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 18\
**Last updated:** [April 10, 2019, 7:01pm UTC](https://discourse.julialang.org/t/passing-sub-array-by-reference-performance/22978 "2019-04-10T19:01:48Z")

</div>

In trying to pass subarrays by reference in a computer intensive code, I found the “view” function, which appeared to be the solution. However, I see important performance issues using that option relative to passing the…

---

## [Collecting algebraic performance tricks](https://discourse.julialang.org/t/collecting-algebraic-performance-tricks/22992)

<div class="topic-metadata">

**Author:** [@theogf](https://discourse.julialang.org/u/theogf)\
**Replies:** 10\
**Last updated:** [April 10, 2019, 2:04pm UTC](https://discourse.julialang.org/t/collecting-algebraic-performance-tricks/22992 "2019-04-10T14:04:09Z")

</div>

There are many ways to dramatically improve performance by using some algebraic equivalencies, for example : tr(A\*B) == dot(A,B') diag(A\*B) == vec(sum(A.\*B',dims=2)) Do you know if there are ressources listing this ki…

---

## [Positive Definite Matrices, Symmetric or Hermitian](https://discourse.julialang.org/t/positive-definite-matrices-symmetric-or-hermitian/22965)

<div class="topic-metadata">

**Author:** [@Marco-Congedo](https://discourse.julialang.org/u/Marco-Congedo)\
**Replies:** 4\
**Last updated:** [April 10, 2019, 8:31am UTC](https://discourse.julialang.org/t/positive-definite-matrices-symmetric-or-hermitian/22965 "2019-04-10T08:31:09Z")

</div>

Hello, I am writing a package for manipulating positive definite matrices on their Riemannian manifold. Those matrix may be real or complex and the code should be able to treat either case alike. My code involves stan…

---

## [Parallel computation of multiplication of large matrices](https://discourse.julialang.org/t/parallel-computation-of-multiplication-of-large-matrices/22898)

<div class="topic-metadata">

**Author:** [@iamsuddhasattwa](https://discourse.julialang.org/u/iamsuddhasattwa)\
**Replies:** 5\
**Last updated:** [April 8, 2019, 4:07pm UTC](https://discourse.julialang.org/t/parallel-computation-of-multiplication-of-large-matrices/22898 "2019-04-08T16:07:35Z")

</div>

A common task in many programs is to multiply two large matrices, namely, A = B \*C. Is there a way to do it in a way that utlizes all the processors ? This is a task that is theoretically, very easy to parallelize over a…

---

## [Fastest Approach to reading Binary Files](https://discourse.julialang.org/t/fastest-approach-to-reading-binary-files/22888)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 2\
**Last updated:** [April 7, 2019, 8:33pm UTC](https://discourse.julialang.org/t/fastest-approach-to-reading-binary-files/22888 "2019-04-07T20:33:08Z")

</div>

Hey guys! I am using Julia 1.1 to read binary vtk files, in which some parameters are known and their corresponding filetype. My brother has made a script which utilizes the “readuntil” functionality to detect the attri…

---

## [Basic I/O and more](https://discourse.julialang.org/t/basic-i-o-and-more/20940)

<div class="topic-metadata">

**Author:** [@binarygcd](https://discourse.julialang.org/u/binarygcd)\
**Replies:** 6\
**Last updated:** [April 7, 2019, 9:17am UTC](https://discourse.julialang.org/t/basic-i-o-and-more/20940 "2019-04-07T09:17:34Z")

</div>

Hi Everyone. I have some simple questions. 1 - What is the best(time and space wise) way to read 3 integers in a single line from stdin or a file? How about if there are arbitrary numbers of integers in a line and you n…

---

## [Fastest quadratic mixing rule?](https://discourse.julialang.org/t/fastest-quadratic-mixing-rule/22785)

<div class="topic-metadata">

**Author:** [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Replies:** 2\
**Last updated:** [April 6, 2019, 12:55am UTC](https://discourse.julialang.org/t/fastest-quadratic-mixing-rule/22785 "2019-04-06T00:55:07Z")

</div>

I’m in need of a good mixing rule function. A mixing rule is a type of of weighed mean. if we have a property p and some weights x, a mixing rule is like this: p\_mixing = sum(op(pi,pj)\*xi\*xj for i,j = 1:N) the op(pi,pj…

---

## [Possible inefficiency in randn!](https://discourse.julialang.org/t/possible-inefficiency-in-randn/22732)

<div class="topic-metadata">

**Author:** [@baggepinnen](https://discourse.julialang.org/u/baggepinnen)\
**Replies:** 5\
**Last updated:** [April 4, 2019, 8:07am UTC](https://discourse.julialang.org/t/possible-inefficiency-in-randn/22732 "2019-04-04T08:07:41Z")

</div>

The following two functions seem to do exactly the same thing, but the built-in version (randn!) is some 60% slower. Am I missing something or could randn! be implemented more efficiently? using Random broadcast\_randn(x…

---

## [Any benchmark of Julia v1.0 vs older versions](https://discourse.julialang.org/t/any-benchmark-of-julia-v1-0-vs-older-versions/13330)

<div class="topic-metadata">

**Author:** [@Juan](https://discourse.julialang.org/u/Juan)\
**Replies:** 66\
**Last updated:** [April 3, 2019, 10:37am UTC](https://discourse.julialang.org/t/any-benchmark-of-julia-v1-0-vs-older-versions/13330 "2019-04-03T10:37:19Z")

</div>

Hello. Where can I find a comparison of the speed of Julia v1.0 vs other versions such as v0.7, v0.6, v0.5 or against other languages?

---

## [Why are vectorized operations faster in julia?](https://discourse.julialang.org/t/why-are-vectorized-operations-faster-in-julia/22603)

<div class="topic-metadata">

**Author:** [@sagartewari01](https://discourse.julialang.org/u/sagartewari01)\
**Replies:** 3\
**Last updated:** [April 1, 2019, 6:37pm UTC](https://discourse.julialang.org/t/why-are-vectorized-operations-faster-in-julia/22603 "2019-04-01T18:37:05Z")

</div>

In case of numpy, vectorization offloads heavy computation to the code in compiled libraries, improving speed. Julia by default compiles down to machine code, why then is this implementation of reduce operation faster th…

---

## [OpenBLAS: Julia slower than R](https://discourse.julialang.org/t/openblas-julia-slower-than-r/21594)

<div class="topic-metadata">

**Author:** [@pedro.rafae](https://discourse.julialang.org/u/pedro.rafae)\
**Replies:** 41\
**Last updated:** [March 26, 2019, 12:04pm UTC](https://discourse.julialang.org/t/openblas-julia-slower-than-r/21594 "2019-03-26T12:04:57Z")

</div>

Dear, I am not a programmer for Julia and so most likely my doubt is due to the little knowledge I have of Julia. On a computer, I tried to produce similar codes from the Julia and R languages and got a lower performanc…

---

## [Subtracting row minima](https://discourse.julialang.org/t/subtracting-row-minima/22508)

<div class="topic-metadata">

**Author:** [@Wikunia](https://discourse.julialang.org/u/Wikunia)\
**Replies:** 9\
**Last updated:** [March 30, 2019, 2:22am UTC](https://discourse.julialang.org/t/subtracting-row-minima/22508 "2019-03-30T02:22:59Z")

</div>

I know that arrays are column based in julia but maybe I’m missing something. Want to subtract the column minimum from each column in a matrix and then the same with rows. Currently doing this: # subtract col minimum …

---

## [Efficient creation of power series matrix or array of arrays](https://discourse.julialang.org/t/efficient-creation-of-power-series-matrix-or-array-of-arrays/18988)

<div class="topic-metadata">

**Author:** [@taqtiqa-mark](https://discourse.julialang.org/u/taqtiqa-mark)\
**Replies:** 23\
**Last updated:** [March 29, 2019, 7:24am UTC](https://discourse.julialang.org/t/efficient-creation-of-power-series-matrix-or-array-of-arrays/18988 "2019-03-29T07:24:50Z")

</div>

Hi, Thank you for all the effort that has gone into getting Julia to this point. I’m very new to Julia and trying to get my head around when I get faster run-times or smaller fpo-counts by handing things over to the co…

---

## [IFFT Inverse discrete Fourier transform](https://discourse.julialang.org/t/ifft-inverse-discrete-fourier-transform/22434)

<div class="topic-metadata">

**Author:** [@Aquaman](https://discourse.julialang.org/u/Aquaman)\
**Replies:** 2\
**Last updated:** [March 28, 2019, 1:44am UTC](https://discourse.julialang.org/t/ifft-inverse-discrete-fourier-transform/22434 "2019-03-28T01:44:45Z")

</div>

Dear All, how can we solve IFFT Inverse discrete Fourier transform problem in Julia? in Matlab is IFFT function.

---

## [Subplot(xyz)](https://discourse.julialang.org/t/subplot-xyz/22432)

<div class="topic-metadata">

**Author:** [@Aquaman](https://discourse.julialang.org/u/Aquaman)\
**Replies:** 2\
**Last updated:** [March 27, 2019, 9:58pm UTC](https://discourse.julialang.org/t/subplot-xyz/22432 "2019-03-27T21:58:45Z")

</div>

Dear All, how can I use subplot in the following way? In matlab: nn =2; subplot(2,2,nn); In Julia using PyPlot nn = 2 subplot(12nn) ValueError('Integer subplot specification must be a three-digit number, not 36',) …

---

## [LAPACK multithreading](https://discourse.julialang.org/t/lapack-multithreading/22230)

<div class="topic-metadata">

**Author:** [@abhinavd](https://discourse.julialang.org/u/abhinavd)\
**Replies:** 3\
**Last updated:** [March 27, 2019, 9:01pm UTC](https://discourse.julialang.org/t/lapack-multithreading/22230 "2019-03-27T21:01:24Z")

</div>

Hello everyone, I would like to know how the binaries on the Julia downloads page page are generated. For example, what are the default compilation flags used? Would I get the same result if I compiled them on some (Lin…

---

## [Allocating a space for a 1d array of matrices](https://discourse.julialang.org/t/allocating-a-space-for-a-1d-array-of-matrices/22342)

<div class="topic-metadata">

**Author:** [@zdenek\_hurak](https://discourse.julialang.org/u/zdenek_hurak)\
**Replies:** 2\
**Last updated:** [March 26, 2019, 10:18am UTC](https://discourse.julialang.org/t/allocating-a-space-for-a-1d-array-of-matrices/22342 "2019-03-26T10:18:22Z")

</div>

What is the right way to allocate space for a 1d array of matrices? In particular, I know that that in my algorithm I will have to determine a sequence matrices, each of size n x m with Float64 entries. The length N of…

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

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