# Performance

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

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

**Page:** 56

---

## [Coercing Data Type of Large Matrix](https://discourse.julialang.org/t/coercing-data-type-of-large-matrix/89494)

<div class="topic-metadata">

**Author:** [@nosewitz](https://discourse.julialang.org/u/nosewitz)\
**Replies:** 0\
**Last updated:** [October 29, 2022, 4:02pm UTC](https://discourse.julialang.org/t/coercing-data-type-of-large-matrix/89494 "2022-10-29T16:02:00Z")

</div>

I have a sparse matrix with dimensions 800 x 100,000 filled solely with binary data (1 or 0), when loading it into a table with MLJ, their type is determined to be count data. I am able to change it into the OrderedFacto…

---

## [Reading text files with wrapped numerical data](https://discourse.julialang.org/t/reading-text-files-with-wrapped-numerical-data/89409)

<div class="topic-metadata">

**Author:** [@rafael.guerra](https://discourse.julialang.org/u/rafael.guerra)\
**Replies:** 8\
**Last updated:** [October 29, 2022, 6:46am UTC](https://discourse.julialang.org/t/reading-text-files-with-wrapped-numerical-data/89409 "2022-10-29T06:46:34Z")

</div>

In the following example, the input text file contains numeric data spread over several rows. Assuming that the number of columns (=7) is known and that all input data can be read as Float64, is there a better way to re…

---

## [The huge difference of two functions for the same goal inside and outside of function](https://discourse.julialang.org/t/the-huge-difference-of-two-functions-for-the-same-goal-inside-and-outside-of-function/89389)

<div class="topic-metadata">

**Author:** [@swish47](https://discourse.julialang.org/u/swish47)\
**Replies:** 5\
**Last updated:** [October 27, 2022, 8:22pm UTC](https://discourse.julialang.org/t/the-huge-difference-of-two-functions-for-the-same-goal-inside-and-outside-of-function/89389 "2022-10-27T20:22:49Z")

</div>

There are two functions for computing the same array. However, there is a weird thing on time elapse. Inside function: using FLoops ot=collect(range(start=-3,length=3600\*4,stop=3)); st=rand(1000000); sgf::Vector{Comple…

---

## [Why are macros re-pre-compiled](https://discourse.julialang.org/t/why-are-macros-re-pre-compiled/89319)

<div class="topic-metadata">

**Author:** [@tfiers](https://discourse.julialang.org/u/tfiers)\
**Replies:** 4\
**Last updated:** [October 27, 2022, 3:39pm UTC](https://discourse.julialang.org/t/why-are-macros-re-pre-compiled/89319 "2022-10-27T15:39:26Z")

</div>

I am trying to improve load time of a package of mine. I found that a lot of this time was spent type-inferring macro-related functions, for example: Through using @match (Match.jl): Match.gen\_match\_expr(::String, :…

---

## [Slowdown due to subnormal float, coming from neural net training](https://discourse.julialang.org/t/slowdown-due-to-subnormal-float-coming-from-neural-net-training/89286)

<div class="topic-metadata">

**Author:** [@Fabrice\_Rosay](https://discourse.julialang.org/u/Fabrice_Rosay)\
**Replies:** 20\
**Last updated:** [October 27, 2022, 11:03am UTC](https://discourse.julialang.org/t/slowdown-due-to-subnormal-float-coming-from-neural-net-training/89286 "2022-10-27T11:03:04Z")

</div>

Here is a minimal working example function mygemavx!(C, A, B, bias) @turbo for m ∈ axes(A,1) Cmk = bias\[m\] for k ∈ axes(A,2) Cmk += A\[m,k\] \* B\[k\] end C\[m\] = Cmk end C end A1=zeros…

---

## [Does Julia's speed get slower over time in REPL?](https://discourse.julialang.org/t/does-julias-speed-get-slower-over-time-in-repl/89066)

<div class="topic-metadata">

**Author:** [@tiZ](https://discourse.julialang.org/u/tiZ)\
**Replies:** 4\
**Last updated:** [October 27, 2022, 4:25am UTC](https://discourse.julialang.org/t/does-julias-speed-get-slower-over-time-in-repl/89066 "2022-10-27T04:25:36Z")

</div>

When I’m on a Julia REPL that has been running for a while, I find that julia will slow down, but if I restart the REPL, the speed returns to normal. For example, I have a function denoted f(x), that takes 15 minutes in…

---

## [Most efficient way to add new columns in each SubDataFrame of a GroupDataFrame](https://discourse.julialang.org/t/most-efficient-way-to-add-new-columns-in-each-subdataframe-of-a-groupdataframe/89272)

<div class="topic-metadata">

**Author:** [@phantom](https://discourse.julialang.org/u/phantom)\
**Replies:** 6\
**Last updated:** [October 27, 2022, 2:08am UTC](https://discourse.julialang.org/t/most-efficient-way-to-add-new-columns-in-each-subdataframe-of-a-groupdataframe/89272 "2022-10-27T02:08:14Z")

</div>

Sorry kind of a beginners question again. Suppose I have a large GroupDataFrame and I would like to add columns to each SubDataFrame in the Group. function build(GDF) for k = eachindex(GDF) GDF\[k\].newcol1 = fun…

---

## [@turbo macro gives incorrect results](https://discourse.julialang.org/t/turbo-macro-gives-incorrect-results/89280)

<div class="topic-metadata">

**Author:** [@sidelkin](https://discourse.julialang.org/u/sidelkin)\
**Replies:** 4\
**Last updated:** [October 26, 2022, 3:53pm UTC](https://discourse.julialang.org/t/turbo-macro-gives-incorrect-results/89280 "2022-10-26T15:53:47Z")

</div>

I often use the @turbo macro for calculations. But I recently discovered that using it sometimes gives incorrect results. Below are minimal working examples where different options are compared. using LoopVectorization …

---

## [Problem with LoopVectorization : @turbo, LoopVectorization.check\_args](https://discourse.julialang.org/t/problem-with-loopvectorization-turbo-loopvectorization-check-args/77963)

<div class="topic-metadata">

**Author:** [@Elyco](https://discourse.julialang.org/u/Elyco)\
**Replies:** 27\
**Last updated:** [October 26, 2022, 2:46pm UTC](https://discourse.julialang.org/t/problem-with-loopvectorization-turbo-loopvectorization-check-args/77963 "2022-10-26T14:46:50Z")

</div>

Hi, I’m trying to optimize a loop and I get a warning about \`LoopVectorization.check\_args\` on your inputs failed. Here is my MWE: psi = rand(ComplexF64,4,4) dpsi = zeros(ComplexF64,4,4) function test\_turbo(dpsi::Arr…

---

## [Fastest way to negate some booleans in an array](https://discourse.julialang.org/t/fastest-way-to-negate-some-booleans-in-an-array/89261)

<div class="topic-metadata">

**Author:** [@HMegh](https://discourse.julialang.org/u/HMegh)\
**Replies:** 10\
**Last updated:** [October 26, 2022, 12:28am UTC](https://discourse.julialang.org/t/fastest-way-to-negate-some-booleans-in-an-array/89261 "2022-10-26T00:28:31Z")

</div>

Hi, I am trying to optimize a code for a number theory side project. Currently, I have a large vector of booleans, say A=rand(Bool,10^8) I want to negate all the even-index terms. One possible way that I have found is …

---

## [Fixing type stability involving functions](https://discourse.julialang.org/t/fixing-type-stability-involving-functions/89258)

<div class="topic-metadata">

**Author:** [@yhchang96](https://discourse.julialang.org/u/yhchang96)\
**Replies:** 1\
**Last updated:** [October 25, 2022, 7:48pm UTC](https://discourse.julialang.org/t/fixing-type-stability-involving-functions/89258 "2022-10-25T19:48:46Z")

</div>

I have the following codes using Parameters function spatiotemporal(x, t, a\_coefs::AbstractMatrix, b\_coefs::AbstractMatrix) ns = size(a\_coefs,1) - 1 nt = Int((size(a\_coefs,2) - 1)/2) c = zero(eltype(a\_coe…

---

## [Where is load-time spent (with skipped precompilation)](https://discourse.julialang.org/t/where-is-load-time-spent-with-skipped-precompilation/89201)

<div class="topic-metadata">

**Author:** [@tfiers](https://discourse.julialang.org/u/tfiers)\
**Replies:** 1\
**Last updated:** [October 25, 2022, 12:30am UTC](https://discourse.julialang.org/t/where-is-load-time-spent-with-skipped-precompilation/89201 "2022-10-25T00:30:03Z")

</div>

In a new Julia session, I import a custom package of mine: @time @time\_imports using VoltoMapSim which gives \[ Info: Precompiling VoltoMapSim \[f713100b-c48c-421a-b480-5fcb4c589a9e\] \[ Info: Skipping precompilation sinc…

---

## [Need Help implementing Large Tensor Factorization in Julia](https://discourse.julialang.org/t/need-help-implementing-large-tensor-factorization-in-julia/89236)

<div class="topic-metadata">

**Author:** [@mj2984](https://discourse.julialang.org/u/mj2984)\
**Replies:** 3\
**Last updated:** [October 25, 2022, 9:32am UTC](https://discourse.julialang.org/t/need-help-implementing-large-tensor-factorization-in-julia/89236 "2022-10-25T09:32:57Z")

</div>

I am looking to implement this paper in Julia : Complex Embeddings for Simple Link Prediction (arxiv.org). I initially tried to set up a Tensor of the size of entity and relations I have and it was too large to fit into …

---

## [Building a PC optimized for "time to first plot"](https://discourse.julialang.org/t/building-a-pc-optimized-for-time-to-first-plot/88801)

<div class="topic-metadata">

**Author:** [@pepijndevos](https://discourse.julialang.org/u/pepijndevos)\
**Replies:** 86\
**Last updated:** [October 23, 2022, 11:18pm UTC](https://discourse.julialang.org/t/building-a-pc-optimized-for-time-to-first-plot/88801 "2022-10-23T23:18:25Z")

</div>

It would really improve my experience with Julia if loading a bunch of big package ecosystems wouldn’t cause a considerable delay while a bunch of stuff gets recompiled. Revise.jl is great but sometimes doesn’t work when…

---

## [How to optimize computation within vectorized list operation and large array?](https://discourse.julialang.org/t/how-to-optimize-computation-within-vectorized-list-operation-and-large-array/89008)

<div class="topic-metadata">

**Author:** [@swish47](https://discourse.julialang.org/u/swish47)\
**Replies:** 16\
**Last updated:** [October 21, 2022, 4:23pm UTC](https://discourse.julialang.org/t/how-to-optimize-computation-within-vectorized-list-operation-and-large-array/89008 "2022-10-21T16:23:27Z")

</div>

I want to do this type of computation: ot=collect(range(start=-3,length=3600\*4,stop=3)); st=rand(1000000); sgf=zeros(ComplexF64, length(ot)); @elapsed @time for nn in 1:length(ot) sgf\[nn\]=sum(1 ./ (ot\[nn\]+0.001\*im.-…

---

## [Memory hogging loops](https://discourse.julialang.org/t/memory-hogging-loops/89073)

<div class="topic-metadata">

**Author:** [@jrhalket](https://discourse.julialang.org/u/jrhalket)\
**Replies:** 18\
**Last updated:** [October 22, 2022, 6:32am UTC](https://discourse.julialang.org/t/memory-hogging-loops/89073 "2022-10-22T06:32:34Z")

</div>

Hi all, I’m still trying to figure out how to get around a familiar problem regarding repeated calls of a function causing nearly linearly increases in memory demands. Here’s a minimal example. I’m not really interested …

---

## [Significant time spent in type inference in profiler flame graphs](https://discourse.julialang.org/t/significant-time-spent-in-type-inference-in-profiler-flame-graphs/89094)

<div class="topic-metadata">

**Author:** [@MilesCranmer](https://discourse.julialang.org/u/MilesCranmer)\
**Replies:** 4\
**Last updated:** [October 22, 2022, 3:58am UTC](https://discourse.julialang.org/t/significant-time-spent-in-type-inference-in-profiler-flame-graphs/89094 "2022-10-22T03:58:45Z")

</div>

I am currently profiling the search speed of SymbolicRegression.jl. In particular I am attempting to speed up this PR, which integrates the package with DynamicExpressions.jl. I am using the following code for profiling…

---

## [Parsing with custom type JSON3 makes performance worse](https://discourse.julialang.org/t/parsing-with-custom-type-json3-makes-performance-worse/89030)

<div class="topic-metadata">

**Author:** [@Robert\_J](https://discourse.julialang.org/u/Robert_J)\
**Replies:** 6\
**Last updated:** [October 21, 2022, 8:56pm UTC](https://discourse.julialang.org/t/parsing-with-custom-type-json3-makes-performance-worse/89030 "2022-10-21T20:56:57Z")

</div>

Here is the sample JSON file: "{\\"topic\\":\\"trade.BTCUSDT\\",\\"data\\":\[{\\"symbol\\":\\"BTCUSDT\\",\\"tick\_direction\\":\\"PlusTick\\",\\"price\\":\\"19431.00\\",\\"size\\":0.2,\\"timestamp\\":\\"2022-10-18T14:50:20.000Z\\",\\"trade\_time\_m…

---

## [Fast LogSumExp over 4th dimension](https://discourse.julialang.org/t/fast-logsumexp-over-4th-dimension/64182)

<div class="topic-metadata">

**Author:** [@jroon](https://discourse.julialang.org/u/jroon)\
**Replies:** 36\
**Last updated:** [October 21, 2022, 5:17pm UTC](https://discourse.julialang.org/t/fast-logsumexp-over-4th-dimension/64182 "2022-10-21T17:17:02Z")

</div>

Hi all, I’m rewriting a function from R to Julia that reduces an array across the 4th dimension via LogSumExp, and I’m currently trying to optimise the speed. I’ve made a bit of progress through the Tullio package, but …

---

## [Speeding up my logsumexp function](https://discourse.julialang.org/t/speeding-up-my-logsumexp-function/42380)

<div class="topic-metadata">

**Author:** [@vkv](https://discourse.julialang.org/u/vkv)\
**Replies:** 35\
**Last updated:** [October 21, 2022, 5:14pm UTC](https://discourse.julialang.org/t/speeding-up-my-logsumexp-function/42380 "2022-10-21T17:14:51Z")

</div>

I wrote a logsumexp function based on the code here, that takes matrix as input and applies logsumexp along a dimension in a numerically stable way. function lsexp\_mat(mat, zero1\_mat; dims=1) # To use the function zer…

---

## [Performance of Horner's method on Vector Polynomial vs Multiplication by Vandermonde Matrix](https://discourse.julialang.org/t/performance-of-horners-method-on-vector-polynomial-vs-multiplication-by-vandermonde-matrix/89035)

<div class="topic-metadata">

**Author:** [@ndinsmore](https://discourse.julialang.org/u/ndinsmore)\
**Replies:** 7\
**Last updated:** [October 21, 2022, 1:30pm UTC](https://discourse.julialang.org/t/performance-of-horners-method-on-vector-polynomial-vs-multiplication-by-vandermonde-matrix/89035 "2022-10-21T13:30:24Z")

</div>

We all know that Horner’s method should be the fastest way to evaluate a polynomial. So it holds that should also be true for a monomial vector polynomial, the coefficients which can be stored in a matrix. Assuming you…

---

## [First call latency in distributed code](https://discourse.julialang.org/t/first-call-latency-in-distributed-code/88917)

<div class="topic-metadata">

**Author:** [@shce](https://discourse.julialang.org/u/shce)\
**Replies:** 42\
**Last updated:** [October 21, 2022, 11:52am UTC](https://discourse.julialang.org/t/first-call-latency-in-distributed-code/88917 "2022-10-21T11:52:38Z")

</div>

Hello! I am facing with an issue I haven’t encountered so far with distributed code. I have a code to optimize some function f for several initial conditions. Function f might be very complicated. To avoid high times i…

---

## [How to efficiently create a table/array through known function?](https://discourse.julialang.org/t/how-to-efficiently-create-a-table-array-through-known-function/88965)

<div class="topic-metadata">

**Author:** [@swish47](https://discourse.julialang.org/u/swish47)\
**Replies:** 6\
**Last updated:** [October 19, 2022, 6:43pm UTC](https://discourse.julialang.org/t/how-to-efficiently-create-a-table-array-through-known-function/88965 "2022-10-19T18:43:33Z")

</div>

As the question, if I want to create a table by a function, I may use collect: @elapsed collect(Vector{Float64}(m\*\[2\*pi,(2pi)/sqrt(3)\]+n\*\[0,(4\*pi)/sqrt(3)\]) for m in range(0.,1.,1001), n in range(0.,1.,1001)) with outp…

---

## [Memory allocation and usage of dot notation](https://discourse.julialang.org/t/memory-allocation-and-usage-of-dot-notation/88951)

<div class="topic-metadata">

**Author:** [@dgegen](https://discourse.julialang.org/u/dgegen)\
**Replies:** 6\
**Last updated:** [October 19, 2022, 6:35pm UTC](https://discourse.julialang.org/t/memory-allocation-and-usage-of-dot-notation/88951 "2022-10-19T18:35:59Z")

</div>

The article Performance Tips advises to pay attention to memory allocation when trying to evaluate or improve the efficiency of a program. This made me wonder whether the estimated number of allocations or the estimated …

---

## [Advice for efficient code containing many lookup table access values](https://discourse.julialang.org/t/advice-for-efficient-code-containing-many-lookup-table-access-values/86522)

<div class="topic-metadata">

**Author:** [@davidbp](https://discourse.julialang.org/u/davidbp)\
**Replies:** 9\
**Last updated:** [October 18, 2022, 11:24pm UTC](https://discourse.julialang.org/t/advice-for-efficient-code-containing-many-lookup-table-access-values/86522 "2022-10-18T23:24:24Z")

</div>

Dear Julians, I want to speed up the following code that iterates over a matrix containing n\_examples vectors of size n\_features. These vectors, stored in PQ, have eltype Integer with values in the range 1 to n\_clust…

---

## [Eigvals faster for ComplexF64 matrices than Float64](https://discourse.julialang.org/t/eigvals-faster-for-complexf64-matrices-than-float64/88846)

<div class="topic-metadata">

**Author:** [@ysh](https://discourse.julialang.org/u/ysh)\
**Replies:** 4\
**Last updated:** [October 18, 2022, 3:15pm UTC](https://discourse.julialang.org/t/eigvals-faster-for-complexf64-matrices-than-float64/88846 "2022-10-18T15:15:06Z")

</div>

I’ve noticed that when diagonalising real symmetric matrices, eigvals may perform faster if the input matrix is complex, i.e. Matrix{ComplexF64} rather than Matrix{Float64}. Here is my test code: using LinearAlgebra, Be…

---

## [Fast check if a character "is" an integer](https://discourse.julialang.org/t/fast-check-if-a-character-is-an-integer/88750)

<div class="topic-metadata">

**Author:** [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Replies:** 23\
**Last updated:** [October 18, 2022, 12:28pm UTC](https://discourse.julialang.org/t/fast-check-if-a-character-is-an-integer/88750 "2022-10-18T12:28:38Z")

</div>

I need to check if the first character of a string is an integer, quickly. I’m doing a try-catch: julia\> function c(name) i0 = try parse(Int, name\[1\]) true catch …

---

## [Performance problem on dual socket Xeon under Windows 11](https://discourse.julialang.org/t/performance-problem-on-dual-socket-xeon-under-windows-11/88772)

<div class="topic-metadata">

**Author:** [@fdekerme](https://discourse.julialang.org/u/fdekerme)\
**Replies:** 6\
**Last updated:** [October 18, 2022, 6:51am UTC](https://discourse.julialang.org/t/performance-problem-on-dual-socket-xeon-under-windows-11/88772 "2022-10-18T06:51:05Z")

</div>

Hello, I have a question about parallelization in Julia. I am working on a Dell dual socket Xeon 5220r workstation ( 2x24 cores, 2x48 threads) running Windows 11. I was initially on Windows 10, but as this old post ( @…

---

## [Does Julia have fast expectations over multivariate Gaussians?](https://discourse.julialang.org/t/does-julia-have-fast-expectations-over-multivariate-gaussians/88834)

<div class="topic-metadata">

**Author:** [@jbrea](https://discourse.julialang.org/u/jbrea)\
**Replies:** 6\
**Last updated:** [October 17, 2022, 4:18pm UTC](https://discourse.julialang.org/t/does-julia-have-fast-expectations-over-multivariate-gaussians/88834 "2022-10-17T16:18:54Z")

</div>

The following approach using HCubature.jl seems rather slow. Is there an easy way to make this faster in Julia? using BenchmarkTools, HCubature, Distributions softplus(x) = log(exp(x) + 1) function integrand(r1, r2, u; …

---

## [Free last part of a vector](https://discourse.julialang.org/t/free-last-part-of-a-vector/88793)

<div class="topic-metadata">

**Author:** [@tfiers](https://discourse.julialang.org/u/tfiers)\
**Replies:** 1\
**Last updated:** [October 16, 2022, 5:48am UTC](https://discourse.julialang.org/t/free-last-part-of-a-vector/88793 "2022-10-16T05:48:13Z")

</div>

I have allocated a long vector, and filled it to nearly the end. I don’t need the last few, remaining elements. That memory can be freed. Is there a way to ‘chop off’ the last part of the vector – without creating a vi…

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

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