# Performance

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

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

**Page:** 104

---

## [A lot of big sparse matrices](https://discourse.julialang.org/t/a-lot-of-big-sparse-matrices/51696)

<div class="topic-metadata">

**Author:** [@Avec](https://discourse.julialang.org/u/Avec)\
**Replies:** 8\
**Last updated:** [December 12, 2020, 2:35pm UTC](https://discourse.julialang.org/t/a-lot-of-big-sparse-matrices/51696 "2020-12-12T14:35:07Z")

</div>

Hi everyone, I need to get a sum of approx 10000 matrices, that are constructed by multiplication with sparse matrices. using LinearAlgebra, SparseArrays n = 101 p = 101 m = 25 #indK = sprand(m, n^2\*p^2, 0.2) EDIT on …

---

## [Zygote vs Jax performance example](https://discourse.julialang.org/t/zygote-vs-jax-performance-example/51300)

<div class="topic-metadata">

**Author:** [@maxfreu](https://discourse.julialang.org/u/maxfreu)\
**Replies:** 14\
**Last updated:** [December 11, 2020, 9:02pm UTC](https://discourse.julialang.org/t/zygote-vs-jax-performance-example/51300 "2020-12-11T21:02:48Z")

</div>

Hi, it’s Saturday and I somehow had a Jax tab open in my browser, so I decided to compare it against Zygote using their third derivative of tanh example: # jax cpu v0.1.57 from jax.numpy import tanh from jax import grad…

---

## [Again on closures and type instability](https://discourse.julialang.org/t/again-on-closures-and-type-instability/51664)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 6\
**Last updated:** [December 11, 2020, 6:10pm UTC](https://discourse.julialang.org/t/again-on-closures-and-type-instability/51664 "2020-12-11T18:10:58Z")

</div>

Consider the simple functions: inner(x,a) = a\*x outer(f,x) = f(x) If one calls outer using a closure and global, non-constant parameter a , we have a type-instability: julia\> a = 5; x = 2; julia\> @code\_warntype outer…

---

## [@threads for loop performance](https://discourse.julialang.org/t/threads-for-loop-performance/51641)

<div class="topic-metadata">

**Author:** [@ankit13](https://discourse.julialang.org/u/ankit13)\
**Replies:** 6\
**Last updated:** [December 11, 2020, 11:57am UTC](https://discourse.julialang.org/t/threads-for-loop-performance/51641 "2020-12-11T11:57:54Z")

</div>

Hi all, Why my code is running slower when I use more number of threads in @threads for loop? I would like to know, if this is a standard behavior for threaded parallelization? This is a sample code that will reprodu…

---

## [Reduce vs splat with intersect() function performance](https://discourse.julialang.org/t/reduce-vs-splat-with-intersect-function-performance/51583)

<div class="topic-metadata">

**Author:** [@rapasite](https://discourse.julialang.org/u/rapasite)\
**Replies:** 1\
**Last updated:** [December 11, 2020, 1:08am UTC](https://discourse.julialang.org/t/reduce-vs-splat-with-intersect-function-performance/51583 "2020-12-11T01:08:20Z")

</div>

Hi. Just trying to understand why the first sum is faster than the second. using BenchmarkTools const data=raw"C:\\text.txt" |\> read |\> String |\> x-\>split(x,r"\\r\\n\\r\\n|\\n\\n") .|\> y-\>split(y,r"\\r\\n|\\r|\\n") @btime sum(le…

---

## [Disabling allocations](https://discourse.julialang.org/t/disabling-allocations/51028)

<div class="topic-metadata">

**Author:** [@Ginter](https://discourse.julialang.org/u/Ginter)\
**Replies:** 50\
**Last updated:** [December 10, 2020, 7:39pm UTC](https://discourse.julialang.org/t/disabling-allocations/51028 "2020-12-10T19:39:12Z")

</div>

Is there a way of disabling allocations altogether within the body of a function? I optimized my code to avoid all allocations, but they keep creeping back in with changes and are annoying to locate. I would much rather …

---

## [Solving Ax=B for large matrix dimensions efficiently in Julia](https://discourse.julialang.org/t/solving-ax-b-for-large-matrix-dimensions-efficiently-in-julia/51504)

<div class="topic-metadata">

**Author:** [@musman](https://discourse.julialang.org/u/musman)\
**Replies:** 12\
**Last updated:** [December 9, 2020, 2:36pm UTC](https://discourse.julialang.org/t/solving-ax-b-for-large-matrix-dimensions-efficiently-in-julia/51504 "2020-12-09T14:36:27Z")

</div>

Hi all, I have the linear set of equation Ax=b where A can be as large as 20000 x 20000 and is invertible. What is the best computationally efficient way of solving this problem in Julia? I have looked into linear alge…

---

## [Simple conditional loop](https://discourse.julialang.org/t/simple-conditional-loop/51402)

<div class="topic-metadata">

**Author:** [@darleybarreto](https://discourse.julialang.org/u/darleybarreto)\
**Replies:** 4\
**Last updated:** [December 7, 2020, 4:05pm UTC](https://discourse.julialang.org/t/simple-conditional-loop/51402 "2020-12-07T16:05:37Z")

</div>

Hi folks, I have a question about ifs inside for loops. Suppose I have this function: function c\_cheating(high) total = 0 high \*= 2 for i in 4:4:high total += i end total end Giving @btime c\_cheating(1\_000\_000)…

---

## [DIfferentialEquations and GPU](https://discourse.julialang.org/t/differentialequations-and-gpu/21219)

<div class="topic-metadata">

**Author:** [@fedoroff](https://discourse.julialang.org/u/fedoroff)\
**Replies:** 15\
**Last updated:** [December 7, 2020, 2:44am UTC](https://discourse.julialang.org/t/differentialequations-and-gpu/21219 "2020-12-07T02:44:24Z")

</div>

Hello, According to the following blog post http://www.stochasticlifestyle.com/solving-systems-stochastic-pdes-using-gpus-julia/ it is very easy to turn on GPU parallelism with DifferentialEquations.jl. The only thing o…

---

## [@code\_lowered vs @code\_typed](https://discourse.julialang.org/t/code-lowered-vs-code-typed/51346)

<div class="topic-metadata">

**Author:** [@cscherrer](https://discourse.julialang.org/u/cscherrer)\
**Replies:** 9\
**Last updated:** [December 6, 2020, 5:12pm UTC](https://discourse.julialang.org/t/code-lowered-vs-code-typed/51346 "2020-12-06T17:12:20Z")

</div>

Where can I find documentation of the difference between these? The main Julia docs aren’t very clear about it. I have an example of two functions where @code\_typed is identical, but @code\_lowered is not. There’s a diff…

---

## [Better compression for JLD2 (Discussion)](https://discourse.julialang.org/t/better-compression-for-jld2-discussion/51306)

<div class="topic-metadata">

**Author:** [@JonasIsensee](https://discourse.julialang.org/u/JonasIsensee)\
**Replies:** 2\
**Last updated:** [December 6, 2020, 2:25pm UTC](https://discourse.julialang.org/t/better-compression-for-jld2-discussion/51306 "2020-12-06T14:25:03Z")

</div>

Hi all, I’m working on bringing faster / more flexible compression to JLD2. Currently you can do @save "test.jld2" {compress=true} a b c and JLD2 will then compress sufficiently large arrays using CodecZlib. This wor…

---

## [Memory usage with large JSON](https://discourse.julialang.org/t/memory-usage-with-large-json/51277)

<div class="topic-metadata">

**Author:** [@evanfields](https://discourse.julialang.org/u/evanfields)\
**Replies:** 5\
**Last updated:** [December 6, 2020, 12:45am UTC](https://discourse.julialang.org/t/memory-usage-with-large-json/51277 "2020-12-06T00:45:19Z")

</div>

I was using JSON to parse a large (1.6 GB) JSON file, and the memory usage was surprising. More surprisingly, perhaps, was that even after removing the reference to the parsed object and garbage collecting, the memory us…

---

## [What is faster? Modular Arithmetic functions and operations](https://discourse.julialang.org/t/what-is-faster-modular-arithmetic-functions-and-operations/51211)

<div class="topic-metadata">

**Author:** [@Renan\_Rabelo](https://discourse.julialang.org/u/Renan_Rabelo)\
**Replies:** 20\
**Last updated:** [December 4, 2020, 1:08am UTC](https://discourse.julialang.org/t/what-is-faster-modular-arithmetic-functions-and-operations/51211 "2020-12-04T01:08:25Z")

</div>

I need to calculate the remainder of a 50000 digits BigInt divided by a 49999 digits BigInt What’s the fastest way to do it? mod()? mod1()? x%y? rem()? Is there any package to do it? Thanks!

---

## [What does mean if memory allocations are shown on struct elements?](https://discourse.julialang.org/t/what-does-mean-if-memory-allocations-are-shown-on-struct-elements/51212)

<div class="topic-metadata">

**Author:** [@JuergenD](https://discourse.julialang.org/u/JuergenD)\
**Replies:** 0\
**Last updated:** [December 3, 2020, 5:20pm UTC](https://discourse.julialang.org/t/what-does-mean-if-memory-allocations-are-shown-on-struct-elements/51212 "2020-12-03T17:20:55Z")

</div>

Hi, using julia --track-allocation=user the following extract was written into a \*.mem file. What does it mean when track-allocation reports memory allocations on a specific element of the struct? Where do I need to loo…

---

## [Any improvements in threaded exception handling in 1.5?](https://discourse.julialang.org/t/any-improvements-in-threaded-exception-handling-in-1-5/51206)

<div class="topic-metadata">

**Author:** [@tro3](https://discourse.julialang.org/u/tro3)\
**Replies:** 0\
**Last updated:** [December 3, 2020, 4:20pm UTC](https://discourse.julialang.org/t/any-improvements-in-threaded-exception-handling-in-1-5/51206 "2020-12-03T16:20:03Z")

</div>

Turning back towards maintenance on ThreadPools.jl, were there any improvements in the 1.5 release around exception handling during threaded operations? Historically in 1.3, those exceptions have vanished into the ether…

---

## [Saving Profile data](https://discourse.julialang.org/t/saving-profile-data/51173)

<div class="topic-metadata">

**Author:** [@paulmelis](https://discourse.julialang.org/u/paulmelis)\
**Replies:** 13\
**Last updated:** [December 3, 2020, 10:17am UTC](https://discourse.julialang.org/t/saving-profile-data/51173 "2020-12-03T10:17:48Z")

</div>

Is there a way to save the profiling data gathered by the Profile module? I don’t see a user-facing API for it, although some methods come close, like fetch(). I’d like to capture the profiling statistics of a large batc…

---

## [Julia Micro-Benchmarks graph](https://discourse.julialang.org/t/julia-micro-benchmarks-graph/50005)

<div class="topic-metadata">

**Author:** [@markcbaumann](https://discourse.julialang.org/u/markcbaumann)\
**Replies:** 10\
**Last updated:** [December 3, 2020, 6:42am UTC](https://discourse.julialang.org/t/julia-micro-benchmarks-graph/50005 "2020-12-03T06:42:57Z")

</div>

I have a question about the graph on Julia Micro-Benchmarks What is the vertical axis of this graph? What are its units?

---

## [Delegating efficiently iteration from one object to another](https://discourse.julialang.org/t/delegating-efficiently-iteration-from-one-object-to-another/51098)

<div class="topic-metadata">

**Author:** [@Jean\_Michel](https://discourse.julialang.org/u/Jean_Michel)\
**Replies:** 40\
**Last updated:** [December 2, 2020, 10:17pm UTC](https://discourse.julialang.org/t/delegating-efficiently-iteration-from-one-object-to-another/51098 "2020-12-02T22:17:26Z")

</div>

My problem occured while trying to write an efficient iterator for permutations groups: they can be efficient generated by running throught the products of some lists of permutations (some transversals). I …

---

## [Improving speed of convolutions of same sized arrays](https://discourse.julialang.org/t/improving-speed-of-convolutions-of-same-sized-arrays/51124)

<div class="topic-metadata">

**Author:** [@heltonmc](https://discourse.julialang.org/u/heltonmc)\
**Replies:** 6\
**Last updated:** [December 2, 2020, 9:44pm UTC](https://discourse.julialang.org/t/improving-speed-of-convolutions-of-same-sized-arrays/51124 "2020-12-02T21:44:18Z")

</div>

Hi everyone, I have been trying to improve the performance of a model that I am using to fit experimental data with LsqFit. Unfortunately, after calculating the theoretical solution it must be convolved with a same size…

---

## [Most accurate way to compute x/sqrt(y) in Julia?](https://discourse.julialang.org/t/most-accurate-way-to-compute-x-sqrt-y-in-julia/51061)

<div class="topic-metadata">

**Author:** [@marcus](https://discourse.julialang.org/u/marcus)\
**Replies:** 11\
**Last updated:** [December 1, 2020, 8:39pm UTC](https://discourse.julialang.org/t/most-accurate-way-to-compute-x-sqrt-y-in-julia/51061 "2020-12-01T20:39:28Z")

</div>

As part of a numerical algorithm, I want to compute x/\\sqrt{y} for real numbers x and y. In general is it preferable to compute x/sqrt(y) or x\*sqrt(1/y) or x\*1/sqrt(y)? As a slightly less trivial example, is there an op…

---

## [Multi-threaded matrix exponential slower than the single threaded version](https://discourse.julialang.org/t/multi-threaded-matrix-exponential-slower-than-the-single-threaded-version/51009)

<div class="topic-metadata">

**Author:** [@JakobA](https://discourse.julialang.org/u/JakobA)\
**Replies:** 7\
**Last updated:** [December 1, 2020, 3:49am UTC](https://discourse.julialang.org/t/multi-threaded-matrix-exponential-slower-than-the-single-threaded-version/51009 "2020-12-01T03:49:29Z")

</div>

I am trying to perform many matrix exponentials in parallel. However, the multi-threaded code running on 40 cores (2x Skylake 6148) takes about twice as long as the single-threaded code. Here is a minimal working example…

---

## [Implementing finite difference with periodic B.C](https://discourse.julialang.org/t/implementing-finite-difference-with-periodic-b-c/50975)

<div class="topic-metadata">

**Author:** [@yhchang](https://discourse.julialang.org/u/yhchang)\
**Replies:** 9\
**Last updated:** [November 30, 2020, 9:09pm UTC](https://discourse.julialang.org/t/implementing-finite-difference-with-periodic-b-c/50975 "2020-11-30T21:09:39Z")

</div>

I am pretty new to Julia and ultimately I want to transfer my python code for solving a nonlinear PDE into Julia (and see whether I can get the speedup I hope). The PDE I want to solve is similar to a nonlinear heat equ…

---

## [How to call wait on multiple Tasks?](https://discourse.julialang.org/t/how-to-call-wait-on-multiple-tasks/50981)

<div class="topic-metadata">

**Author:** [@s-kap](https://discourse.julialang.org/u/s-kap)\
**Replies:** 3\
**Last updated:** [November 30, 2020, 7:46pm UTC](https://discourse.julialang.org/t/how-to-call-wait-on-multiple-tasks/50981 "2020-11-30T19:46:18Z")

</div>

Hey all, I have some code that uses @spawn to generate ~50 tasks tasks=Vector{Task}() function process\_row\_group(range::Tuple{Int64,RangeMarker}) for col\_name in col\_names push!(tasks, Threads.@spawn proces…

---

## [Performance of recursively building tuples](https://discourse.julialang.org/t/performance-of-recursively-building-tuples/50917)

<div class="topic-metadata">

**Author:** [@Benny](https://discourse.julialang.org/u/Benny)\
**Replies:** 6\
**Last updated:** [November 30, 2020, 2:51am UTC](https://discourse.julialang.org/t/performance-of-recursively-building-tuples/50917 "2020-11-30T02:51:58Z")

</div>

I was reading through the source code for broadcasting and CartesianIndices, and I noticed that there were many methods that recursively operated on tuples. I thought it strange because I thought iteration was more intui…

---

## [Permutation of elements in array + composition of functions resulting into an extremely inefficient runtime?](https://discourse.julialang.org/t/permutation-of-elements-in-array-composition-of-functions-resulting-into-an-extremely-inefficient-runtime/48047)

<div class="topic-metadata">

**Author:** [@GuidoDipietro](https://discourse.julialang.org/u/GuidoDipietro)\
**Replies:** 6\
**Last updated:** [November 28, 2020, 7:50pm UTC](https://discourse.julialang.org/t/permutation-of-elements-in-array-composition-of-functions-resulting-into-an-extremely-inefficient-runtime/48047 "2020-11-28T19:50:22Z")

</div>

Hey there. I have started using Julia today or yesterday, and there is something happening here that is driving me a little bit crazy. I wanted to model a group of permutations (specifically, the permutation group of a …

---

## [Constant time Gaussian and Bilateral filter](https://discourse.julialang.org/t/constant-time-gaussian-and-bilateral-filter/50867)

<div class="topic-metadata">

**Author:** [@Geoffrey](https://discourse.julialang.org/u/Geoffrey)\
**Replies:** 5\
**Last updated:** [November 28, 2020, 12:47pm UTC](https://discourse.julialang.org/t/constant-time-gaussian-and-bilateral-filter/50867 "2020-11-28T12:47:47Z")

</div>

Hi, I’m still learning the julia language and to do so I try to implement different published algorithms that I found useful for my work (I’m a biologist and I do a lot of image analysis). So I have an implementation of…

---

## ['using Plots' takes 20 seconds or more](https://discourse.julialang.org/t/using-plots-takes-20-seconds-or-more/7061)

<div class="topic-metadata">

**Author:** [@airpmb](https://discourse.julialang.org/u/airpmb)\
**Replies:** 30\
**Last updated:** [November 27, 2020, 12:17pm UTC](https://discourse.julialang.org/t/using-plots-takes-20-seconds-or-more/7061 "2020-11-27T12:17:39Z")

</div>

I’ve read that calls to using Plots can sometimes be slow but I wonder if as slow as I’m seeing is normal. On 3 trials after starting Julia from the command line I @timed this taking between 35 and 40 seconds. After som…

---

## [I can't get to the "end of inflation" with DifferentialEquations.jl](https://discourse.julialang.org/t/i-cant-get-to-the-end-of-inflation-with-differentialequations-jl/50697)

<div class="topic-metadata">

**Author:** [@MrSantiagoPrado](https://discourse.julialang.org/u/MrSantiagoPrado)\
**Replies:** 20\
**Last updated:** [November 26, 2020, 12:19pm UTC](https://discourse.julialang.org/t/i-cant-get-to-the-end-of-inflation-with-differentialequations-jl/50697 "2020-11-26T12:19:00Z")

</div>

Hello all, I’ve been struggling to get the full solution to a set of ODE’s that describe an inflationary cosmology, where the equations, the value of the constants and the initial values are given below on the code. In t…

---

## [Distributed Or , julia logicals operators](https://discourse.julialang.org/t/distributed-or-julia-logicals-operators/50698)

<div class="topic-metadata">

**Author:** [@rapasite](https://discourse.julialang.org/u/rapasite)\
**Replies:** 0\
**Last updated:** [November 24, 2020, 5:03pm UTC](https://discourse.julialang.org/t/distributed-or-julia-logicals-operators/50698 "2020-11-24T17:03:25Z")

</div>

I asked a question on https://julialang.org/slack/. Question was: Is there any way to write something like x == (4 | 5) witch return true if x == 4 or if x == 5? The regular answer is: x in (4,5) or any other way …

---

## [How to parellalizing many matrix solves](https://discourse.julialang.org/t/how-to-parellalizing-many-matrix-solves/50603)

<div class="topic-metadata">

**Author:** [@Pulpo](https://discourse.julialang.org/u/Pulpo)\
**Replies:** 5\
**Last updated:** [November 23, 2020, 10:44pm UTC](https://discourse.julialang.org/t/how-to-parellalizing-many-matrix-solves/50603 "2020-11-23T22:44:45Z")

</div>

I am trying to solve many matrix equations Ax=b of fixed size. A simplified version of the code is as follows: function ser\_solve(A,b,res,nu) for i in(1:nu) res\[i,:\]=A\[i,:,:\]\\b\[i,:\] end return res; e…

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

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