# Performance

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

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

**Page:** 52

---

## [Are there any julia zmq.jl examples](https://discourse.julialang.org/t/are-there-any-julia-zmq-jl-examples/76996)

<div class="topic-metadata">

**Author:** [@anon69491625](https://discourse.julialang.org/u/anon69491625)\
**Replies:** 4\
**Last updated:** [January 4, 2023, 10:12am UTC](https://discourse.julialang.org/t/are-there-any-julia-zmq-jl-examples/76996 "2023-01-04T10:12:39Z")

</div>

I am investigating using ZMQ to move a data stream around my project and would like to see some examples but I can’t find any for julia. My use case is to take streamed data and filter it to other julia scripts running …

---

## [Getting SQLite data without runtime dispatch](https://discourse.julialang.org/t/getting-sqlite-data-without-runtime-dispatch/91789)

<div class="topic-metadata">

**Author:** [@taotree](https://discourse.julialang.org/u/taotree)\
**Replies:** 1\
**Last updated:** [January 4, 2023, 4:26am UTC](https://discourse.julialang.org/t/getting-sqlite-data-without-runtime-dispatch/91789 "2023-01-04T04:26:42Z")

</div>

I can’t figure out how to avoid runtime dispatch when using SQLite (or understand if the profiler is indicating incorrectly). I ran @profview, and it’s showing most of the time in SQLite.getvalue, I think the call to sql…

---

## [Dot product not parallelized on cluster](https://discourse.julialang.org/t/dot-product-not-parallelized-on-cluster/92472)

<div class="topic-metadata">

**Author:** [@nbakas](https://discourse.julialang.org/u/nbakas)\
**Replies:** 4\
**Last updated:** [January 4, 2023, 3:12am UTC](https://discourse.julialang.org/t/dot-product-not-parallelized-on-cluster/92472 "2023-01-04T03:12:00Z")

</div>

I am trying to optimize a code involving a dot product which is called many times. I run the code on a cluster’s node with 256 threads, using the built-in dot. I check with htop the performance of the threads, and only…

---

## [Exponential of a "large" vector is faster in Matlab](https://discourse.julialang.org/t/exponential-of-a-large-vector-is-faster-in-matlab/92468)

<div class="topic-metadata">

**Author:** [@alexdmeyer](https://discourse.julialang.org/u/alexdmeyer)\
**Replies:** 5\
**Last updated:** [January 4, 2023, 12:04am UTC](https://discourse.julialang.org/t/exponential-of-a-large-vector-is-faster-in-matlab/92468 "2023-01-04T00:04:27Z")

</div>

Hi Julia folks, In my current project, the rate-limiting step of a simulation model is evaluating the element-wise exponential of a vector with about N = 30,000 elements: # Julia MWE using Random trials = 10^4 # numb…

---

## [Accuracy issues on Flux](https://discourse.julialang.org/t/accuracy-issues-on-flux/92016)

<div class="topic-metadata">

**Author:** [@Radu\_Mihai\_Diaconu](https://discourse.julialang.org/u/Radu_Mihai_Diaconu)\
**Replies:** 25\
**Last updated:** [January 3, 2023, 3:43pm UTC](https://discourse.julialang.org/t/accuracy-issues-on-flux/92016 "2023-01-03T15:43:17Z")

</div>

Hello guys. I have a problem with Flux. I have a very low accuracy (about 50%) on this code and I dont know why. i converted some tf code to Flux bu i dont get the issue. i mention that i am new to Julia and Flux so mayb…

---

## [Gemm! vs symm! performance](https://discourse.julialang.org/t/gemm-vs-symm-performance/92201)

<div class="topic-metadata">

**Author:** [@PharmCat](https://discourse.julialang.org/u/PharmCat)\
**Replies:** 7\
**Last updated:** [January 2, 2023, 8:19pm UTC](https://discourse.julialang.org/t/gemm-vs-symm-performance/92201 "2023-01-02T20:19:58Z")

</div>

Hi! I try to compare gemm! or symm! performance and get these results for small matrices. gemm! have much better performance, when to use symm!? C = rand(10, 10) A = rand(10, 10) B = rand(10, 10) julia\> @benchmark Lin…

---

## [Speeding up solving \`Ax=b\` repeated when \`A\` is partially updated](https://discourse.julialang.org/t/speeding-up-solving-ax-b-repeated-when-a-is-partially-updated/92194)

<div class="topic-metadata">

**Author:** [@yhchang96](https://discourse.julialang.org/u/yhchang96)\
**Replies:** 4\
**Last updated:** [December 29, 2022, 10:09pm UTC](https://discourse.julialang.org/t/speeding-up-solving-ax-b-repeated-when-a-is-partially-updated/92194 "2022-12-29T22:09:10Z")

</div>

I need to solve for Ax=b where x and b are both vectors of length N+1. A is matrix of size (N+1,N+1). A has a certain structure: A\[1:N,N+1\]=1, A\[N+1,1:N\]=1, A\[N+1,N+1\]=0, and A\[1:N,1:N\] = matD + Diagonal(d). matD is a m…

---

## [Parallel computing with \*](https://discourse.julialang.org/t/parallel-computing-with/92276)

<div class="topic-metadata">

**Author:** [@austin-putz](https://discourse.julialang.org/u/austin-putz)\
**Replies:** 27\
**Last updated:** [December 29, 2022, 9:14pm UTC](https://discourse.julialang.org/t/parallel-computing-with/92276 "2022-12-29T21:14:47Z")

</div>

So I was testing julia with different number of threads using $ julia -t 1 or $ julia -t 7. I run versioninfo() and it confirms that I do in fact have 1 or 7 cores on a basic desktop setup. I tested a decent sized matrix…

---

## [Performance of splitting string and parsing numbers](https://discourse.julialang.org/t/performance-of-splitting-string-and-parsing-numbers/92161)

<div class="topic-metadata">

**Author:** [@tk3369](https://discourse.julialang.org/u/tk3369)\
**Replies:** 29\
**Last updated:** [December 29, 2022, 7:56am UTC](https://discourse.julialang.org/t/performance-of-splitting-string-and-parsing-numbers/92161 "2022-12-29T07:56:05Z")

</div>

Given a string of numbers that are grouped in blocks, I want to parse the numbers and find the total of each block, and then return the largest value from the totals. Each block is separated by two newline chars, and eac…

---

## [Weird string slicing in korean](https://discourse.julialang.org/t/weird-string-slicing-in-korean/92252)

<div class="topic-metadata">

**Author:** [@rmsmsgood](https://discourse.julialang.org/u/rmsmsgood)\
**Replies:** 3\
**Last updated:** [December 29, 2022, 2:50am UTC](https://discourse.julialang.org/t/weird-string-slicing-in-korean/92252 "2022-12-29T02:50:06Z")

</div>

I have a trouble with korean string: julia\> julia = "julia" "julia" julia\> julia\[1:2\] "ju" julia\> julia = "줄리아" "줄리아" julia\> julia\[1:2\] ERROR: StringIndexError: invalid index \[2\], valid nearby indices \[1\]=\>'줄', \[4\]=\>'…

---

## [Is \>5 min startup considered slow?](https://discourse.julialang.org/t/is-5-min-startup-considered-slow/69674)

<div class="topic-metadata">

**Author:** [@Bardo](https://discourse.julialang.org/u/Bardo)\
**Replies:** 24\
**Last updated:** [December 28, 2022, 10:06pm UTC](https://discourse.julialang.org/t/is-5-min-startup-considered-slow/69674 "2022-12-28T22:06:26Z")

</div>

Hi, Activating Extensions... Starting Julia Language server 2:20 Julia Language Server: Indexing packages... 8:12 VScode closed and started again Activating Extensions... Starting Julia Language server 0:42 Julia Lang…

---

## [Faster quadratic expression for symmetric matrices](https://discourse.julialang.org/t/faster-quadratic-expression-for-symmetric-matrices/91843)

<div class="topic-metadata">

**Author:** [@corbat](https://discourse.julialang.org/u/corbat)\
**Replies:** 12\
**Last updated:** [December 27, 2022, 6:04am UTC](https://discourse.julialang.org/t/faster-quadratic-expression-for-symmetric-matrices/91843 "2022-12-27T06:04:16Z")

</div>

Hi, I have a use case where I need to evaluate many quadratic expressions of the form x^T M x, with the matrix M always beeing symmetric. The typical dimensionality of M is between 3 and 3000. Using the following two ap…

---

## [Could anyone make this run faster?](https://discourse.julialang.org/t/could-anyone-make-this-run-faster/92145)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 21\
**Last updated:** [December 26, 2022, 9:09pm UTC](https://discourse.julialang.org/t/could-anyone-make-this-run-faster/92145 "2022-12-26T21:09:38Z")

</div>

Hello! I apologize for using unicode characters before hand, but I really like it :slight\_smile: I have a function given as: function ∇ᵢWᵢⱼ(αD,q,xᵢⱼ,h) # Skip distances outside the support of the kernel: if q \< …

---

## [Improving performance: large amount of time on getindex and setindex!](https://discourse.julialang.org/t/improving-performance-large-amount-of-time-on-getindex-and-setindex/92166)

<div class="topic-metadata">

**Author:** [@james3](https://discourse.julialang.org/u/james3)\
**Replies:** 1\
**Last updated:** [December 26, 2022, 8:46pm UTC](https://discourse.julialang.org/t/improving-performance-large-amount-of-time-on-getindex-and-setindex/92166 "2022-12-26T20:46:58Z")

</div>

I am trying to improve the performance of my code. If I profile (Profile.@profile), ~40% of the time is spent on getindex and setindex!. My code is making extensive use of multidimensional arrays, which I suspect is resp…

---

## [Issues with distributed package](https://discourse.julialang.org/t/issues-with-distributed-package/92158)

<div class="topic-metadata">

**Author:** [@tomd](https://discourse.julialang.org/u/tomd)\
**Replies:** 0\
**Last updated:** [December 26, 2022, 6:14pm UTC](https://discourse.julialang.org/t/issues-with-distributed-package/92158 "2022-12-26T18:14:59Z")

</div>

Hello! I have a code which has to deal with large arrays: l = length(A) m = 56^2 flag = trues(l) flatten\_connectivity = Array{Float32, 2}(undef, l, m) for i = 1:l flatten\_connectivity\[i, :\] …

---

## [CellListMap: Go from list of pairs to list of indices](https://discourse.julialang.org/t/celllistmap-go-from-list-of-pairs-to-list-of-indices/91974)

<div class="topic-metadata">

**Author:** [@Ahmed\_Salih](https://discourse.julialang.org/u/Ahmed_Salih)\
**Replies:** 8\
**Last updated:** [December 26, 2022, 11:30am UTC](https://discourse.julialang.org/t/celllistmap-go-from-list-of-pairs-to-list-of-indices/91974 "2022-12-26T11:30:26Z")

</div>

Hello! I am using CellListMap to generate a neighbour list of the type: ListOfPairs = (1,4,0.04) (1,3,0.02) (1,8,0.09) (2,1,0.01) (2,4,0.05) Where first index is “i”, second index is “j” and third index is the eu…

---

## [@generated functions aggressively disallowing lambdas (and accusations of impurity! how impious!)](https://discourse.julialang.org/t/generated-functions-aggressively-disallowing-lambdas-and-accusations-of-impurity-how-impious/92072)

<div class="topic-metadata">

**Author:** [@uniment](https://discourse.julialang.org/u/uniment)\
**Replies:** 0\
**Last updated:** [December 24, 2022, 1:10am UTC](https://discourse.julialang.org/t/generated-functions-aggressively-disallowing-lambdas-and-accusations-of-impurity-how-impious/92072 "2022-12-24T01:10:36Z")

</div>

This seems a bit aggressive: Code 1: julia\> @generated f(x) = :( map(i-\>i, x) ) f (generic function with 1 method) julia\> f((1,2,3)) ERROR: The function body AST defined by this @generated function is not pure. This l…

---

## [Very long stack trace](https://discourse.julialang.org/t/very-long-stack-trace/92025)

<div class="topic-metadata">

**Author:** [@erlebach](https://discourse.julialang.org/u/erlebach)\
**Replies:** 15\
**Last updated:** [December 23, 2022, 11:01pm UTC](https://discourse.julialang.org/t/very-long-stack-trace/92025 "2022-12-23T23:01:11Z")

</div>

I am running a SciML type program called RUDE. The code generates an error, with a stack trace of almost 1000 lines long. I attach the trace herein. Perhaps somebody could give me sense of what the error is about? Perhap…

---

## [Solving the diffusion equation in Julia](https://discourse.julialang.org/t/solving-the-diffusion-equation-in-julia/28811)

<div class="topic-metadata">

**Author:** [@linwaytin](https://discourse.julialang.org/u/linwaytin)\
**Replies:** 23\
**Last updated:** [December 22, 2022, 10:53pm UTC](https://discourse.julialang.org/t/solving-the-diffusion-equation-in-julia/28811 "2022-12-22T22:53:59Z")

</div>

I’m learning how to solve PDEs numerically. The code I wrote in Julia 1.2.0 is as follows: using PyCall so = pyimport("scipy.optimize") using PyPlot I = im h\_s = 0.1 h\_t = 0.02 T = 100.0 L\_x = 30.0 L\_y = 30.0 ddx(u…

---

## [Speeding up operations on large arrays](https://discourse.julialang.org/t/speeding-up-operations-on-large-arrays/91966)

<div class="topic-metadata">

**Author:** [@rkube](https://discourse.julialang.org/u/rkube)\
**Replies:** 6\
**Last updated:** [December 21, 2022, 5:06pm UTC](https://discourse.julialang.org/t/speeding-up-operations-on-large-arrays/91966 "2022-12-21T17:06:06Z")

</div>

Hi, I’m working on a code that needs to calculate many, simple arithmetic on slices of large arrays. Ideally I’d like to understand how to speed up this code and explored multiple approaches: function sub\_single(x1, x…

---

## [\`sort\` vs \`copy\`+\`sort!\`](https://discourse.julialang.org/t/sort-vs-copy-sort/91919)

<div class="topic-metadata">

**Author:** [@Dan](https://discourse.julialang.org/u/Dan)\
**Replies:** 3\
**Last updated:** [December 20, 2022, 11:47pm UTC](https://discourse.julialang.org/t/sort-vs-copy-sort/91919 "2022-12-20T23:47:19Z")

</div>

This is run on Julia 1.8.3 using BenchmarkTools function benchsort(L) v = rand(L) @show L @btime sort($v) @btime sort!($v) @btime sort!(copy($v)) nothing end Running this with 2048 length vecto…

---

## [Generator slow when passed as argument](https://discourse.julialang.org/t/generator-slow-when-passed-as-argument/91606)

<div class="topic-metadata">

**Author:** [@uniment](https://discourse.julialang.org/u/uniment)\
**Replies:** 6\
**Last updated:** [December 20, 2022, 3:02am UTC](https://discourse.julialang.org/t/generator-slow-when-passed-as-argument/91606 "2022-12-20T03:02:47Z")

</div>

(Julia 1.9.0-alpha1) Why is this? julia\> @btime let x=(a=1,b=2,c=3,d=4,e=5,f=6,g=7,h=8) ns=propertynames(x) NamedTuple{ns}(map(n-\>getproperty(x,n), ns)) end 1.000 ns (0 allocations: 0 byt…

---

## [Type-Instability when calling \`fieldtypes\`](https://discourse.julialang.org/t/type-instability-when-calling-fieldtypes/91881)

<div class="topic-metadata">

**Author:** [@uniment](https://discourse.julialang.org/u/uniment)\
**Replies:** 0\
**Last updated:** [December 20, 2022, 1:05am UTC](https://discourse.julialang.org/t/type-instability-when-calling-fieldtypes/91881 "2022-12-20T01:05:21Z")

</div>

Is there a way to make fieldtypes not be type-unstable here? julia\> struct Foo{A,B} a::A; b::B end julia\> ft1(o::T) where T = Tuple(T.types) ft1 (generic function with 1 method) julia\> ft2(o::T) where T = fieldtypes(T…

---

## [Obtaining the type of the state object returned by Iterate](https://discourse.julialang.org/t/obtaining-the-type-of-the-state-object-returned-by-iterate/59190)

<div class="topic-metadata">

**Author:** [@Olof\_Salberger](https://discourse.julialang.org/u/Olof_Salberger)\
**Replies:** 4\
**Last updated:** [December 17, 2022, 12:15pm UTC](https://discourse.julialang.org/t/obtaining-the-type-of-the-state-object-returned-by-iterate/59190 "2022-12-17T12:15:35Z")

</div>

An issue I’ve run into is that if you have a container type T, in general it isn’t possible to obtain the type of state returned by iterate in the same way as you can get eltype(T) since there is no (let’s call it iterat…

---

## [Slowdown with reinterpret](https://discourse.julialang.org/t/slowdown-with-reinterpret/91749)

<div class="topic-metadata">

**Author:** [@dgleich](https://discourse.julialang.org/u/dgleich)\
**Replies:** 3\
**Last updated:** [December 16, 2022, 7:06pm UTC](https://discourse.julialang.org/t/slowdown-with-reinterpret/91749 "2022-12-16T19:06:47Z")

</div>

I hope I can be forgiven for being surprised at the starkly difference between these implementations. using BenchmarkTools function myfunc1(n::Int) x = Vector{Int}(undef, 3\*n) for i in eachindex(x) x\[i\] = i en…

---

## [Accelerate computation of derivatives of vector field?](https://discourse.julialang.org/t/accelerate-computation-of-derivatives-of-vector-field/91314)

<div class="topic-metadata">

**Author:** [@Michael](https://discourse.julialang.org/u/Michael)\
**Replies:** 12\
**Last updated:** [December 16, 2022, 6:47pm UTC](https://discourse.julialang.org/t/accelerate-computation-of-derivatives-of-vector-field/91314 "2022-12-16T18:47:52Z")

</div>

Hi everyone! I am trying to compute Lie brackets of two vector fields let us say F0 and F1. They’re in dimension 6 and I need brackets until length 5 (thus, derivative up to order 5). Unfortunately this is extremely sl…

---

## [Try-catch statement really slow even if catch is never executed](https://discourse.julialang.org/t/try-catch-statement-really-slow-even-if-catch-is-never-executed/91744)

<div class="topic-metadata">

**Author:** [@HashBrown](https://discourse.julialang.org/u/HashBrown)\
**Replies:** 9\
**Last updated:** [December 16, 2022, 4:08pm UTC](https://discourse.julialang.org/t/try-catch-statement-really-slow-even-if-catch-is-never-executed/91744 "2022-12-16T16:08:09Z")

</div>

Consider the following functions that add the elements of a vector: slow(v) = begin s = v |\> eltype |\> zero for ele in v try s += ele catch rethrow() end end …

---

## [Performance optimization of a custom binning function](https://discourse.julialang.org/t/performance-optimization-of-a-custom-binning-function/91616)

<div class="topic-metadata">

**Author:** [@alex-s-gardner](https://discourse.julialang.org/u/alex-s-gardner)\
**Replies:** 43\
**Last updated:** [December 15, 2022, 11:08pm UTC](https://discourse.julialang.org/t/performance-optimization-of-a-custom-binning-function/91616 "2022-12-15T23:08:36Z")

</div>

I’m looking for feedback on how I might be able to further optimize the below bin function. There are a couple of coding patterns that I’m curious to get feedback on, specifically my approach to internal array initializa…

---

## [Tail-call recursion](https://discourse.julialang.org/t/tail-call-recursion/87847)

<div class="topic-metadata">

**Author:** [@gbellomia](https://discourse.julialang.org/u/gbellomia)\
**Replies:** 41\
**Last updated:** [December 15, 2022, 7:38pm UTC](https://discourse.julialang.org/t/tail-call-recursion/87847 "2022-12-15T19:38:26Z")

</div>

Does Julia have tail call elimination? And how good it is implemented? To clarify: it really is a design choice somehow, strongly functional oriented or pure functional languages normally are really good at this, as recu…

---

## [Function that fixes an argument of another function](https://discourse.julialang.org/t/function-that-fixes-an-argument-of-another-function/91423)

<div class="topic-metadata">

**Author:** [@DanielVandH](https://discourse.julialang.org/u/DanielVandH)\
**Replies:** 4\
**Last updated:** [December 14, 2022, 10:46pm UTC](https://discourse.julialang.org/t/function-that-fixes-an-argument-of-another-function/91423 "2022-12-14T22:46:46Z")

</div>

I need to define a function that fixes the value of another function’s argument. One way is the following: using InvertedIndices, PreallocationTools, BenchmarkTools function construct\_fixed\_f(g, n, val, cache) new\_f…

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

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