# Performance

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

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

**Page:** 46

---

## [Best Debug Workflow for Dr Watson](https://discourse.julialang.org/t/best-debug-workflow-for-dr-watson/97234)

<div class="topic-metadata">

**Author:** [@WillHWThompson](https://discourse.julialang.org/u/WillHWThompson)\
**Replies:** 7\
**Last updated:** [April 8, 2023, 6:03am UTC](https://discourse.julialang.org/t/best-debug-workflow-for-dr-watson/97234 "2023-04-08T06:03:39Z")

</div>

I am extremely frustrated by my current workflow. There has to be a better way and I wanted to ask for advice. Here is how I have been working. I use Dr. Watson for all of my projects. I write all my store all my source…

---

## [Efficient repeated sampling of small vector](https://discourse.julialang.org/t/efficient-repeated-sampling-of-small-vector/97093)

<div class="topic-metadata">

**Author:** [@PaterPen](https://discourse.julialang.org/u/PaterPen)\
**Replies:** 13\
**Last updated:** [April 8, 2023, 2:10am UTC](https://discourse.julialang.org/t/efficient-repeated-sampling-of-small-vector/97093 "2023-04-08T02:10:36Z")

</div>

Hi, my problem is simple: I am currently playing around with Multi-Armed Bandits and long story short in every iteration step I need to sample 10 iid. random variables (one for each arm). I noticed that it takes signifi…

---

## [Adjoint for threaded map (ThreadsX.map)](https://discourse.julialang.org/t/adjoint-for-threaded-map-threadsx-map/97142)

<div class="topic-metadata">

**Author:** [@mfishelson](https://discourse.julialang.org/u/mfishelson)\
**Replies:** 1\
**Last updated:** [April 6, 2023, 2:02am UTC](https://discourse.julialang.org/t/adjoint-for-threaded-map-threadsx-map/97142 "2023-04-06T02:02:43Z")

</div>

I am using Zygote to compute the gradient of a function which calls map(f, x), where applying f to each element of the array x is slow. I would like to speed up the gradient computation by using a threaded map such as Th…

---

## [Who does "better" than DataFrames?](https://discourse.julialang.org/t/who-does-better-than-dataframes/96946)

<div class="topic-metadata">

**Author:** [@rocco\_sprmnt21](https://discourse.julialang.org/u/rocco_sprmnt21)\
**Replies:** 43\
**Last updated:** [April 6, 2023, 12:55am UTC](https://discourse.julialang.org/t/who-does-better-than-dataframes/96946 "2023-04-06T00:55:25Z")

</div>

given a list of observations (simulations, trials, results) find the list of “best” results for each simulation. In the context of DataFrames, using the minilanguage, the problem is solved by calling the following funct…

---

## [Zero elements in sparse matrix](https://discourse.julialang.org/t/zero-elements-in-sparse-matrix/97134)

<div class="topic-metadata">

**Author:** [@Nova](https://discourse.julialang.org/u/Nova)\
**Replies:** 3\
**Last updated:** [April 5, 2023, 9:24pm UTC](https://discourse.julialang.org/t/zero-elements-in-sparse-matrix/97134 "2023-04-05T21:24:39Z")

</div>

How to find the index of zero elements in a sparse matrix efficiently? I have a matrix with a size of 200k by 200k.

---

## [Partition of distributed arrays in Julia](https://discourse.julialang.org/t/partition-of-distributed-arrays-in-julia/97122)

<div class="topic-metadata">

**Author:** [@Hana](https://discourse.julialang.org/u/Hana)\
**Replies:** 0\
**Last updated:** [April 5, 2023, 4:40pm UTC](https://discourse.julialang.org/t/partition-of-distributed-arrays-in-julia/97122 "2023-04-05T16:40:48Z")

</div>

0 my problem is to complete partition\_data(strain::AbstractArray, stress::AbstractArray) in Julia. In this function, the strain/stress arguments are Arrays that contain the entire stress and strain data only on the proc…

---

## [Optim search/convergence speed](https://discourse.julialang.org/t/optim-search-convergence-speed/97083)

<div class="topic-metadata">

**Author:** [@X\_Chen](https://discourse.julialang.org/u/X_Chen)\
**Replies:** 0\
**Last updated:** [April 4, 2023, 8:23pm UTC](https://discourse.julialang.org/t/optim-search-convergence-speed/97083 "2023-04-04T20:23:34Z")

</div>

Hello! I am using Optim.optimize to conduct a MLE algorithm with 6 parameters. The objective function is defined as follows: function r\_obj(r\_para) print(r\_para) df\_y\_1\_p\_0.LL\_1 = cap\_p.((r\_prob\_0(r\_para,df\_0.x3…

---

## [How to read Parquet files using Parquet2 in a multi-folder structure?](https://discourse.julialang.org/t/how-to-read-parquet-files-using-parquet2-in-a-multi-folder-structure/96957)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 1\
**Last updated:** [April 3, 2023, 5:53pm UTC](https://discourse.julialang.org/t/how-to-read-parquet-files-using-parquet2-in-a-multi-folder-structure/96957 "2023-04-03T17:53:19Z")

</div>

Hello! Suppose I have a folder structure given as: TopFolder A B C Where parquet files are stored inside of A,B and C. I know that if I do: Parquet2.Dataset("TopFolder") Then it will have access to all the parque…

---

## [Weird memory allocation when passing functions as keyword arguments](https://discourse.julialang.org/t/weird-memory-allocation-when-passing-functions-as-keyword-arguments/96920)

<div class="topic-metadata">

**Author:** [@sunoru](https://discourse.julialang.org/u/sunoru)\
**Replies:** 6\
**Last updated:** [April 3, 2023, 3:01pm UTC](https://discourse.julialang.org/t/weird-memory-allocation-when-passing-functions-as-keyword-arguments/96920 "2023-04-03T15:01:28Z")

</div>

I was trying to understand the cause of some unexpected memory allocations and found the program has the following strange behaviors. I am really confused and hope someone can help me figure it out, thanks! I tested on 1…

---

## [Better way to improve a function with splat operator used in the input](https://discourse.julialang.org/t/better-way-to-improve-a-function-with-splat-operator-used-in-the-input/96744)

<div class="topic-metadata">

**Author:** [@linwaytin](https://discourse.julialang.org/u/linwaytin)\
**Replies:** 15\
**Last updated:** [April 1, 2023, 8:34pm UTC](https://discourse.julialang.org/t/better-way-to-improve-a-function-with-splat-operator-used-in-the-input/96744 "2023-04-01T20:34:11Z")

</div>

I have a multi-variate function like function f(input::Vararg{Int, N}) where {N} # some stuff end I need to call it using the form f(x1..., xi, xn...), where x1 and xn are vectors determined in the runtime. The splat …

---

## [Sort StaticVector?](https://discourse.julialang.org/t/sort-staticvector/96591)

<div class="topic-metadata">

**Author:** [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Replies:** 7\
**Last updated:** [March 31, 2023, 10:43am UTC](https://discourse.julialang.org/t/sort-staticvector/96591 "2023-03-31T10:43:12Z")

</div>

Hi, I wonder if there is specific sorting functions for StaticArrays (e.g. sorting network) ?

---

## [Julia multithreading is running slower than serial, can someone please explain why…? General Usage Performance multithreading floops](https://discourse.julialang.org/t/julia-multithreading-is-running-slower-than-serial-can-someone-please-explain-why-general-usage-performance-multithreading-floops/96657)

<div class="topic-metadata">

**Author:** [@nethaji8](https://discourse.julialang.org/u/nethaji8)\
**Replies:** 17\
**Last updated:** [March 31, 2023, 10:30am UTC](https://discourse.julialang.org/t/julia-multithreading-is-running-slower-than-serial-can-someone-please-explain-why-general-usage-performance-multithreading-floops/96657 "2023-03-31T10:30:46Z")

</div>

Dear Julia community this is my third post after my previous post1, post2. I was unable to replicate my problem in my previous posts. Here, I am going to share my entire algorithm. Please let me know what the problem is…

---

## [Compiler optimizations for ComplexF64 vs Fortran](https://discourse.julialang.org/t/compiler-optimizations-for-complexf64-vs-fortran/96346)

<div class="topic-metadata">

**Author:** [@bremez](https://discourse.julialang.org/u/bremez)\
**Replies:** 7\
**Last updated:** [March 30, 2023, 6:23pm UTC](https://discourse.julialang.org/t/compiler-optimizations-for-complexf64-vs-fortran/96346 "2023-03-30T18:23:49Z")

</div>

My former colleague Michael Rutter now posted his comparison of Fortran compilers regarding their optimization of complex number arithmetic. I was wondering if anyone would like to see how Julia matches these? For examp…

---

## [Parellelization for large ODEs, Multithreading fails](https://discourse.julialang.org/t/parellelization-for-large-odes-multithreading-fails/96811)

<div class="topic-metadata">

**Author:** [@Rezair](https://discourse.julialang.org/u/Rezair)\
**Replies:** 16\
**Last updated:** [March 30, 2023, 5:49pm UTC](https://discourse.julialang.org/t/parellelization-for-large-odes-multithreading-fails/96811 "2023-03-30T17:49:48Z")

</div>

Hey everyone, I am new to Julia and I wanted to solve a large ODE as fast as possible. I’ve tried multithreading using Threads.@threads and EnsembleThreads() approaches, but they both reduce performance. I’ve also tried …

---

## [Question about type stability and struct](https://discourse.julialang.org/t/question-about-type-stability-and-struct/96834)

<div class="topic-metadata">

**Author:** [@fdekerme](https://discourse.julialang.org/u/fdekerme)\
**Replies:** 2\
**Last updated:** [March 30, 2023, 1:07pm UTC](https://discourse.julialang.org/t/question-about-type-stability-and-struct/96834 "2023-03-30T13:07:21Z")

</div>

Hello ! :smiley: How do you achieve type stability with handwritten structures? For example, in the following code example, what do I need to return in the second return for the function test to be type stable? It retu…

---

## [Clamped View](https://discourse.julialang.org/t/clamped-view/96717)

<div class="topic-metadata">

**Author:** [@weymouth](https://discourse.julialang.org/u/weymouth)\
**Replies:** 13\
**Last updated:** [March 29, 2023, 3:05pm UTC](https://discourse.julialang.org/t/clamped-view/96717 "2023-03-29T15:05:28Z")

</div>

I am trying to define a performant read-only view into an array where the index is clamped to lie within the array axis. The motivation for this is to apply stencils like finite differences and convolutions without needi…

---

## [Why does add-assign to Ref{Float64} allocate?](https://discourse.julialang.org/t/why-does-add-assign-to-ref-float64-allocate/96767)

<div class="topic-metadata">

**Author:** [@AlexanderNenninger](https://discourse.julialang.org/u/AlexanderNenninger)\
**Replies:** 3\
**Last updated:** [March 29, 2023, 12:50pm UTC](https://discourse.julialang.org/t/why-does-add-assign-to-ref-float64-allocate/96767 "2023-03-29T12:50:57Z")

</div>

While optimizing some ODE code, I noticed that += on Ref{Float64} allocates, while .+= on a vector slice doen’t. Why is that? I wasn’t able to reproduce the effect without DifferentialEquations, but I feel like it shoul…

---

## [Produced pie gauge chart using statisticalgraphics package](https://discourse.julialang.org/t/produced-pie-gauge-chart-using-statisticalgraphics-package/96753)

<div class="topic-metadata">

**Author:** [@akshdfyehd](https://discourse.julialang.org/u/akshdfyehd)\
**Replies:** 0\
**Last updated:** [March 29, 2023, 6:17am UTC](https://discourse.julialang.org/t/produced-pie-gauge-chart-using-statisticalgraphics-package/96753 "2023-03-29T06:17:59Z")

</div>

Hi, I have a dataset which looks like this: code to get this dataset: using InMemoryDatasets,DLMReader import Downloads data=Downloads.download("https://raw.githubusercontent.com/akshdfyehd/travel/main/Travel%20deta…

---

## [Inverting a symmetric matrix is not faster than inverting a random one](https://discourse.julialang.org/t/inverting-a-symmetric-matrix-is-not-faster-than-inverting-a-random-one/96654)

<div class="topic-metadata">

**Author:** [@tamasgal](https://discourse.julialang.org/u/tamasgal)\
**Replies:** 15\
**Last updated:** [March 27, 2023, 3:25pm UTC](https://discourse.julialang.org/t/inverting-a-symmetric-matrix-is-not-faster-than-inverting-a-random-one/96654 "2023-03-27T15:25:13Z")

</div>

I thought that inverting a symmetric matrix would be faster, since there are optimised algorithms and I also saw that there is a method explicity for Symmetric, but maybe I am overlooking some trivial things, so please h…

---

## [Package load speed: Windows vs Linux](https://discourse.julialang.org/t/package-load-speed-windows-vs-linux/93039)

<div class="topic-metadata">

**Author:** [@tfiers](https://discourse.julialang.org/u/tfiers)\
**Replies:** 24\
**Last updated:** [March 28, 2023, 12:21pm UTC](https://discourse.julialang.org/t/package-load-speed-windows-vs-linux/93039 "2023-03-28T12:21:21Z")

</div>

I have a feeling that Julia package import times are significantly faster on Linux than on Windows. See e.g. this thread where: @giordano’s seven-year-old Linux laptop loads Unitful in 0.44 seconds my two-year-old Win…

---

## [DifferentialEquations Package Kills Performance Everywhere when TruncatedStacktraces is used](https://discourse.julialang.org/t/differentialequations-package-kills-performance-everywhere-when-truncatedstacktraces-is-used/96417)

<div class="topic-metadata">

**Author:** [@leespen1](https://discourse.julialang.org/u/leespen1)\
**Replies:** 41\
**Last updated:** [March 28, 2023, 11:52am UTC](https://discourse.julialang.org/t/differentialequations-package-kills-performance-everywhere-when-truncatedstacktraces-is-used/96417 "2023-03-28T11:52:38Z")

</div>

After loading the DifferentialEquations.jl package in the REPL, Julia seems to start performing very slowly, possibly only when text is output to the REPL, but in a way that makes the REPL extremely frustrating to use. S…

---

## [How can i improve the performance of the code?](https://discourse.julialang.org/t/how-can-i-improve-the-performance-of-the-code/96622)

<div class="topic-metadata">

**Author:** [@manu\_han](https://discourse.julialang.org/u/manu_han)\
**Replies:** 9\
**Last updated:** [March 28, 2023, 10:17am UTC](https://discourse.julialang.org/t/how-can-i-improve-the-performance-of-the-code/96622 "2023-03-28T10:17:51Z")

</div>

I’m a newbie of julia, and I want to improve the performance of the code included massive iteration and calculation. I Even I red the manual, but I have no ability to adapt all of the solutions… Here is simplified cod…

---

## [ProfileView and Benchmark Disagree on Timing for Simple Matrix Multiplication](https://discourse.julialang.org/t/profileview-and-benchmark-disagree-on-timing-for-simple-matrix-multiplication/96069)

<div class="topic-metadata">

**Author:** [@andrew-saydjari](https://discourse.julialang.org/u/andrew-saydjari)\
**Replies:** 13\
**Last updated:** [March 28, 2023, 3:28am UTC](https://discourse.julialang.org/t/profileview-and-benchmark-disagree-on-timing-for-simple-matrix-multiplication/96069 "2023-03-28T03:28:00Z")

</div>

I am trying to benchmark and improve the cost for matrix multiplication for a custom type I have implemented. But, in trying to do that, I have become confused about the profile and benchmarking results for a simple matr…

---

## [Using TaylorSeries.jl for functions with many variables (~1000)](https://discourse.julialang.org/t/using-taylorseries-jl-for-functions-with-many-variables-1000/96643)

<div class="topic-metadata">

**Author:** [@ejmeitz](https://discourse.julialang.org/u/ejmeitz)\
**Replies:** 20\
**Last updated:** [March 27, 2023, 6:02pm UTC](https://discourse.julialang.org/t/using-taylorseries-jl-for-functions-with-many-variables-1000/96643 "2023-03-27T18:02:55Z")

</div>

I have an application where I need all possible 3rd and 4th order derivatives of a function w.r.t. that function’s inputs. TaylorSeries.jl works brilliantly for this in my toy model; however, my actual use case requires …

---

## [View and boolean indexing](https://discourse.julialang.org/t/view-and-boolean-indexing/96609)

<div class="topic-metadata">

**Author:** [@Paul\_Soderlind](https://discourse.julialang.org/u/Paul_Soderlind)\
**Replies:** 4\
**Last updated:** [March 26, 2023, 5:14pm UTC](https://discourse.julialang.org/t/view-and-boolean-indexing/96609 "2023-03-26T17:14:25Z")

</div>

This old thread brought up an important question about why view(x,boolean\_indices) is slow. One reply said “So the TLDR is: Mixing views and logical indices is currently no good.” It seems to be that we still have this …

---

## [Short delay for first input action in v1.9.0-rc1](https://discourse.julialang.org/t/short-delay-for-first-input-action-in-v1-9-0-rc1/96600)

<div class="topic-metadata">

**Author:** [@Jian\_ZUO](https://discourse.julialang.org/u/Jian_ZUO)\
**Replies:** 4\
**Last updated:** [March 26, 2023, 11:37am UTC](https://discourse.julialang.org/t/short-delay-for-first-input-action-in-v1-9-0-rc1/96600 "2023-03-26T11:37:21Z")

</div>

Hi all, I am using Julia v1.9.0-rc1 and I noticed that there is a short delay for the first action when start Julia (for example in REPL), delayed about 2 seconds. Is this normal? I install Julia through Juliaup and…

---

## [Best way to Synchronize Threads/Lock variables in a nontrivial computation](https://discourse.julialang.org/t/best-way-to-synchronize-threads-lock-variables-in-a-nontrivial-computation/96157)

<div class="topic-metadata">

**Author:** [@eduardosalaz](https://discourse.julialang.org/u/eduardosalaz)\
**Replies:** 4\
**Last updated:** [March 25, 2023, 7:44am UTC](https://discourse.julialang.org/t/best-way-to-synchronize-threads-lock-variables-in-a-nontrivial-computation/96157 "2023-03-25T07:44:10Z")

</div>

Hi everyone. I have several questions regarding Parallel/Concurrent Programming with Julia. I have an algorithm which in simple terms does the following: function main(iters) bestVal = 1e9 fields = generate\_fields…

---

## [Julia multithreading is running slower than serial, can someone please explain why…?](https://discourse.julialang.org/t/julia-multithreading-is-running-slower-than-serial-can-someone-please-explain-why/96545)

<div class="topic-metadata">

**Author:** [@nethaji8](https://discourse.julialang.org/u/nethaji8)\
**Replies:** 14\
**Last updated:** [March 24, 2023, 10:03pm UTC](https://discourse.julialang.org/t/julia-multithreading-is-running-slower-than-serial-can-someone-please-explain-why/96545 "2023-03-24T22:03:49Z")

</div>

I am trying to parallelize an algorithm which looks like this. I couldn’t express my code right in my previous post The following algorithm takes an element from an odd column and adds it to the adjacent even coloumn. u…

---

## [Efficiently in-place filling an array of ForwardDiff.Dual](https://discourse.julialang.org/t/efficiently-in-place-filling-an-array-of-forwarddiff-dual/96537)

<div class="topic-metadata">

**Author:** [@cadaverous](https://discourse.julialang.org/u/cadaverous)\
**Replies:** 2\
**Last updated:** [March 24, 2023, 12:35am UTC](https://discourse.julialang.org/t/efficiently-in-place-filling-an-array-of-forwarddiff-dual/96537 "2023-03-24T00:35:29Z")

</div>

I was able to write function to handle arrays of ForwardDiff.Dual, since in theory I should be able to compute the derivative of a certain function much more efficiently than just propagating Dual numbers through it. I h…

---

## [Performance tips for a function which finds n maximums in a matrix](https://discourse.julialang.org/t/performance-tips-for-a-function-which-finds-n-maximums-in-a-matrix/96425)

<div class="topic-metadata">

**Author:** [@eduardosalaz](https://discourse.julialang.org/u/eduardosalaz)\
**Replies:** 8\
**Last updated:** [March 23, 2023, 5:49am UTC](https://discourse.julialang.org/t/performance-tips-for-a-function-which-finds-n-maximums-in-a-matrix/96425 "2023-03-23T05:49:13Z")

</div>

Hi everyone, I have been trying to squeeze out as much performance as possible out from the following function, which finds the n largest (or maximum) values of a matrix and returns those values and their positions in t…

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

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