# Performance

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

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

**Page:** 127

---

## [Specialized Base.findfirst for ranges](https://discourse.julialang.org/t/specialized-base-findfirst-for-ranges/28460)

<div class="topic-metadata">

**Author:** [@pnalysz](https://discourse.julialang.org/u/pnalysz)\
**Replies:** 2\
**Last updated:** [September 6, 2019, 9:10am UTC](https://discourse.julialang.org/t/specialized-base-findfirst-for-ranges/28460 "2019-09-06T09:10:08Z")

</div>

As far as I see at the moment julia uses the same findfirst method for all AbstractArray which simply iterates through all the items. Would it not make sense to have specialized method for ranges that would find the item…

---

## [What's the fastest to convert a String to an \`Vector{T}\` where \`isbits(T) == true\` and back again?](https://discourse.julialang.org/t/whats-the-fastest-to-convert-a-string-to-an-vector-t-where-isbits-t-true-and-back-again/28458)

<div class="topic-metadata">

**Author:** [@xiaodai](https://discourse.julialang.org/u/xiaodai)\
**Replies:** 2\
**Last updated:** [September 6, 2019, 6:24am UTC](https://discourse.julialang.org/t/whats-the-fastest-to-convert-a-string-to-an-vector-t-where-isbits-t-true-and-back-again/28458 "2019-09-06T06:24:07Z")

</div>

I want to see what’s the fastest way to convert a String to an invertible its binary representation (which I assume will be an array of type T for some T). The codeunit should do the trick but it used to be slow. Also h…

---

## [Use of Vector Libraries](https://discourse.julialang.org/t/use-of-vector-libraries/28062)

<div class="topic-metadata">

**Author:** [@Crown421](https://discourse.julialang.org/u/Crown421)\
**Replies:** 5\
**Last updated:** [September 3, 2019, 11:57pm UTC](https://discourse.julialang.org/t/use-of-vector-libraries/28062 "2019-09-03T23:57:43Z")

</div>

Dear all, TLDR: Are bindings to external vector math libraries still a thing? I am still very new to Julia, but rapidly progressing in search of speed. In this quest I found and used AppleAccelerate to great success, …

---

## [Chained comparisons on arrays allocating](https://discourse.julialang.org/t/chained-comparisons-on-arrays-allocating/28301)

<div class="topic-metadata">

**Author:** [@3d5g](https://discourse.julialang.org/u/3d5g)\
**Replies:** 2\
**Last updated:** [September 2, 2019, 7:21pm UTC](https://discourse.julialang.org/t/chained-comparisons-on-arrays-allocating/28301 "2019-09-02T19:21:04Z")

</div>

I consistently get heap allocations in groups of 3 of 4.33 KiB for each chain of comparisons: x = randn(Float64, (2,3)) y = similar(x) z @btime @. $y = -1 \<= $x \< 1 This prints “481.026 ns (3 allocations: 4.33 KiB)”. …

---

## [Type inference and abstract interpretation](https://discourse.julialang.org/t/type-inference-and-abstract-interpretation/28259)

<div class="topic-metadata">

**Author:** [@aml](https://discourse.julialang.org/u/aml)\
**Replies:** 3\
**Last updated:** [September 2, 2019, 5:59pm UTC](https://discourse.julialang.org/t/type-inference-and-abstract-interpretation/28259 "2019-09-02T17:59:03Z")

</div>

Hi, For pedagogical purposes, I wrote a Scheme interpreter in Julia, which I then updated to become a toy Julia interpreter written in Julia. So far, everything OK, without any relevant performance problems, despite bei…

---

## [Generic way to create repeating tiled views?](https://discourse.julialang.org/t/generic-way-to-create-repeating-tiled-views/28207)

<div class="topic-metadata">

**Author:** [@wsphillips](https://discourse.julialang.org/u/wsphillips)\
**Replies:** 1\
**Last updated:** [August 30, 2019, 12:23pm UTC](https://discourse.julialang.org/t/generic-way-to-create-repeating-tiled-views/28207 "2019-08-30T12:23:35Z")

</div>

LinearAlgebra implements Symmetric, which returns a mirrored view of the upper/lower triangle of a matrix. If I wanted to do something more simple and generic, is it possible using view() or manipulation of ::SubArray ? …

---

## [Passing a function as an argument via closure](https://discourse.julialang.org/t/passing-a-function-as-an-argument-via-closure/28017)

<div class="topic-metadata">

**Author:** [@cpross90](https://discourse.julialang.org/u/cpross90)\
**Replies:** 9\
**Last updated:** [August 28, 2019, 5:09pm UTC](https://discourse.julialang.org/t/passing-a-function-as-an-argument-via-closure/28017 "2019-08-28T17:09:57Z")

</div>

I am creating some numerical methods, and I am running into some issues with closures. Here’s an example of what I’m doing: Function to drive myPkg: function main() #allocate temporaries function linear() …

---

## [How to optimize simple matrix equation solving](https://discourse.julialang.org/t/how-to-optimize-simple-matrix-equation-solving/23035)

<div class="topic-metadata">

**Author:** [@Johncowk](https://discourse.julialang.org/u/Johncowk)\
**Replies:** 16\
**Last updated:** [August 28, 2019, 1:00pm UTC](https://discourse.julialang.org/t/how-to-optimize-simple-matrix-equation-solving/23035 "2019-08-28T13:00:40Z")

</div>

Hello ! I implemented a method which aims at detecting change-point in categorical time-serie, which gives correct results but is way too slow (slower than the python version already available, which is itself already s…

---

## [SingularException(2) error while doing complex matrix inversion](https://discourse.julialang.org/t/singularexception-2-error-while-doing-complex-matrix-inversion/28095)

<div class="topic-metadata">

**Author:** [@mamuniut09](https://discourse.julialang.org/u/mamuniut09)\
**Replies:** 2\
**Last updated:** [August 28, 2019, 11:13am UTC](https://discourse.julialang.org/t/singularexception-2-error-while-doing-complex-matrix-inversion/28095 "2019-08-28T11:13:25Z")

</div>

I wanted to have the inverse of a complex matrix, but it shows SingularException (2) error. For example: a=\[1.0+2.0im 1.0+2.0im; 3.0+4.0im 3.0+4.0im\]; inv(a) It gives the error SingularException(2) I was wondering i…

---

## [Codegen woes](https://discourse.julialang.org/t/codegen-woes/27098)

<div class="topic-metadata">

**Author:** [@cscherrer](https://discourse.julialang.org/u/cscherrer)\
**Replies:** 30\
**Last updated:** [August 27, 2019, 2:16pm UTC](https://discourse.julialang.org/t/codegen-woes/27098 "2019-08-27T14:16:16Z")

</div>

Hello all, There’s an expressiveness problem I’ve been fighting with for quite a while now. I had thought (and hoped, really) I might just be missing something obvious. But from discussions at JuliaCon, it seems at leas…

---

## [Type Inference for CartesianIndices(array) fail when the dimension of the array is too large](https://discourse.julialang.org/t/type-inference-for-cartesianindices-array-fail-when-the-dimension-of-the-array-is-too-large/27952)

<div class="topic-metadata">

**Author:** [@tomohiro\_soejima](https://discourse.julialang.org/u/tomohiro_soejima)\
**Replies:** 3\
**Last updated:** [August 25, 2019, 4:06pm UTC](https://discourse.julialang.org/t/type-inference-for-cartesianindices-array-fail-when-the-dimension-of-the-array-is-too-large/27952 "2019-08-25T16:06:36Z")

</div>

I do a lot of work with high-dimensional arrays, where the dimension of my array is often 20+. I noticed that CartesianIndices fail when the dimension is too large, causing later type inferences to also fail. Here is a m…

---

## [Iteration with CartesianIndices(array) is slow when the dimension of the array is large](https://discourse.julialang.org/t/iteration-with-cartesianindices-array-is-slow-when-the-dimension-of-the-array-is-large/27951)

<div class="topic-metadata">

**Author:** [@tomohiro\_soejima](https://discourse.julialang.org/u/tomohiro_soejima)\
**Replies:** 2\
**Last updated:** [August 25, 2019, 9:06am UTC](https://discourse.julialang.org/t/iteration-with-cartesianindices-array-is-slow-when-the-dimension-of-the-array-is-large/27951 "2019-08-25T09:06:39Z")

</div>

I’ve been playing around with CartesianIndices. It works beautifully for the most part, but I’ve noticed that it becomes slower compared to linear indexing, when the dimension of the array is large. Here is a minimal exa…

---

## [Julia v1.3 runs this script at least 10x slower than Julia v1.1 on my computer](https://discourse.julialang.org/t/julia-v1-3-runs-this-script-at-least-10x-slower-than-julia-v1-1-on-my-computer/27815)

<div class="topic-metadata">

**Author:** [@jdjohnston](https://discourse.julialang.org/u/jdjohnston)\
**Replies:** 3\
**Last updated:** [August 24, 2019, 6:03pm UTC](https://discourse.julialang.org/t/julia-v1-3-runs-this-script-at-least-10x-slower-than-julia-v1-1-on-my-computer/27815 "2019-08-24T18:03:55Z")

</div>

Summary: This memory-hungry script runs more than 10x slower on my computer using any of the newer versions of Julia while it ran fine on Julia 1.1.1 and even early DEV version of Julia 1.3 Environment: Xubuntu 16.04.6…

---

## [Help speeding up a test progam from a book](https://discourse.julialang.org/t/help-speeding-up-a-test-progam-from-a-book/6383)

<div class="topic-metadata">

**Author:** [@Frank\_Applin](https://discourse.julialang.org/u/Frank_Applin)\
**Replies:** 38\
**Last updated:** [August 23, 2019, 8:14pm UTC](https://discourse.julialang.org/t/help-speeding-up-a-test-progam-from-a-book/6383 "2019-08-23T20:14:41Z")

</div>

I am reading the book, Exploring Raspberry Pi - Interfacing to the Real World with Embedded Linux by Derek Molloy. In Chapter 5, Programming on the Raspberry Pi, the author does a speed test to compare different language…

---

## [The first for loop execution](https://discourse.julialang.org/t/the-first-for-loop-execution/27841)

<div class="topic-metadata">

**Author:** [@Mirsad\_Cosovic](https://discourse.julialang.org/u/Mirsad_Cosovic)\
**Replies:** 6\
**Last updated:** [August 23, 2019, 8:07am UTC](https://discourse.julialang.org/t/the-first-for-loop-execution/27841 "2019-08-23T08:07:48Z")

</div>

Hi, I wrote a simple test in Julia, I have a large sparse matrix, and I want to iterate throughout non-zero elements, but the first execution of the for loop is slow. The minimal working example is bellow. Did I do some…

---

## [Performance of map!()](https://discourse.julialang.org/t/performance-of-map/22821)

<div class="topic-metadata">

**Author:** [@Invarianz](https://discourse.julialang.org/u/Invarianz)\
**Replies:** 12\
**Last updated:** [August 23, 2019, 4:06am UTC](https://discourse.julialang.org/t/performance-of-map/22821 "2019-08-23T04:06:02Z")

</div>

Inspired by this topic here: map vs loops vs broadcasts, I wanted to do my own tests on the speed of the functions. As it turns out the optimised for loop, map and vectorisation are all roughly in the same ballpark. Now…

---

## [Speeding up DifferentialEquations solver by using different time steps for an ODE](https://discourse.julialang.org/t/speeding-up-differentialequations-solver-by-using-different-time-steps-for-an-ode/27724)

<div class="topic-metadata">

**Author:** [@rgalarcia](https://discourse.julialang.org/u/rgalarcia)\
**Replies:** 3\
**Last updated:** [August 22, 2019, 2:58pm UTC](https://discourse.julialang.org/t/speeding-up-differentialequations-solver-by-using-different-time-steps-for-an-ode/27724 "2019-08-22T14:58:23Z")

</div>

Dear developers, We are facing a project with the necessity of solving an ODE in Python. In order to do so we opted for a wrapper of Julia as it was the best option we found when a research on which ODE solver was a bet…

---

## [Running out of memory saving files with HDF5](https://discourse.julialang.org/t/running-out-of-memory-saving-files-with-hdf5/27802)

<div class="topic-metadata">

**Author:** [@PhillipBC](https://discourse.julialang.org/u/PhillipBC)\
**Replies:** 7\
**Last updated:** [August 22, 2019, 8:56am UTC](https://discourse.julialang.org/t/running-out-of-memory-saving-files-with-hdf5/27802 "2019-08-22T08:56:40Z")

</div>

Hey, I am trying to run something quite large in Julia, and I need to store a large number of Arrays (for constructing sparse matrices). Below is a simplified version of what I need to do, where it creates a random array…

---

## [Extra allocation in @thread loop in v1.2](https://discourse.julialang.org/t/extra-allocation-in-thread-loop-in-v1-2/27775)

<div class="topic-metadata">

**Author:** [@shipengcheng1230](https://discourse.julialang.org/u/shipengcheng1230)\
**Replies:** 2\
**Last updated:** [August 21, 2019, 5:39pm UTC](https://discourse.julialang.org/t/extra-allocation-in-thread-loop-in-v1-2/27775 "2019-08-21T17:39:19Z")

</div>

Consider the following MWE of threaded element-wise computation: using Base.Threads using LinearAlgebra using BenchmarkTools const N = 100000 a = rand(N) b = rand(N) function foo(a, b) @threads for i ∈ eachindex(a…

---

## [Difference between Set{Int}() and BitSet()](https://discourse.julialang.org/t/difference-between-set-int-and-bitset/27737)

<div class="topic-metadata">

**Author:** [@biona001](https://discourse.julialang.org/u/biona001)\
**Replies:** 2\
**Last updated:** [August 20, 2019, 8:33am UTC](https://discourse.julialang.org/t/difference-between-set-int-and-bitset/27737 "2019-08-20T08:33:26Z")

</div>

I want to compute the intersection of a matrix of sets. I came across BitSet in addition to Set{Int}, and the following benchmarks (which initialize a matrix of Set or BitSet) baffles me in terms of memory usage: julia\> …

---

## [Is Shared Memory Parallel Tasks Possible in Julia?](https://discourse.julialang.org/t/is-shared-memory-parallel-tasks-possible-in-julia/27645)

<div class="topic-metadata">

**Author:** [@Gavinclarke](https://discourse.julialang.org/u/Gavinclarke)\
**Replies:** 4\
**Last updated:** [August 17, 2019, 7:23pm UTC](https://discourse.julialang.org/t/is-shared-memory-parallel-tasks-possible-in-julia/27645 "2019-08-17T19:23:21Z")

</div>

I looking to run separate tasks in parallel that are required to share access to a few variables that are constantly updated in a program that is latency-sensitive. I am starting to see that this may not be currently po…

---

## [SVector vs Vec usage: Why do I have an 8x speedup in a simple example?](https://discourse.julialang.org/t/svector-vs-vec-usage-why-do-i-have-an-8x-speedup-in-a-simple-example/27647)

<div class="topic-metadata">

**Author:** [@davidbp](https://discourse.julialang.org/u/davidbp)\
**Replies:** 7\
**Last updated:** [August 17, 2019, 2:12pm UTC](https://discourse.julialang.org/t/svector-vs-vec-usage-why-do-i-have-an-8x-speedup-in-a-simple-example/27647 "2019-08-17T14:12:40Z")

</div>

Hello, I was playing with both SVector and Vec from StaticArrays and SIMD respectively. I was surprised obtaining an 8x speedup using SVector vs Vec. Am I using Vecin a non suitable example or maybe I’m not using it pr…

---

## [Loop over multi-dimensional array optimization](https://discourse.julialang.org/t/loop-over-multi-dimensional-array-optimization/27539)

<div class="topic-metadata">

**Author:** [@henry2004y](https://discourse.julialang.org/u/henry2004y)\
**Replies:** 9\
**Last updated:** [August 15, 2019, 9:29am UTC](https://discourse.julialang.org/t/loop-over-multi-dimensional-array-optimization/27539 "2019-08-15T09:29:51Z")

</div>

Hi, I encountered a performance bottleneck for array operations. I tried two versions: dot fusion and explicit loop. To my surprise, not only does dot fusion take less time, it also takes less memory, which contradicts …

---

## [Native (oversimplified) Julia gemm implementation](https://discourse.julialang.org/t/native-oversimplified-julia-gemm-implementation/27530)

<div class="topic-metadata">

**Author:** [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Replies:** 6\
**Last updated:** [August 15, 2019, 7:58am UTC](https://discourse.julialang.org/t/native-oversimplified-julia-gemm-implementation/27530 "2019-08-15T07:58:55Z")

</div>

Hi Julians, In the context of a Julia lecture preparation, I have implemented the following (over)simplfied mygemm matrix-matrix product implementation (150 lines): mygemm.jlusing BenchmarkTools using LinearAlgebra usi…

---

## [Relative performance discrepancy across cpus even with --cpu-target set](https://discourse.julialang.org/t/relative-performance-discrepancy-across-cpus-even-with-cpu-target-set/27503)

<div class="topic-metadata">

**Author:** [@non-Jedi](https://discourse.julialang.org/u/non-Jedi)\
**Replies:** 5\
**Last updated:** [August 14, 2019, 8:02pm UTC](https://discourse.julialang.org/t/relative-performance-discrepancy-across-cpus-even-with-cpu-target-set/27503 "2019-08-14T20:02:11Z")

</div>

I’ve been trying to optimize the benchmarks game’s julia programs again, and I’m running into a problem I don’t really know how to work around. The gist is that between two implementations, one is significantly faster…

---

## [How to speed up a generic function evaluating multiple array calculations](https://discourse.julialang.org/t/how-to-speed-up-a-generic-function-evaluating-multiple-array-calculations/27419)

<div class="topic-metadata">

**Author:** [@xor0110](https://discourse.julialang.org/u/xor0110)\
**Replies:** 3\
**Last updated:** [August 13, 2019, 10:48am UTC](https://discourse.julialang.org/t/how-to-speed-up-a-generic-function-evaluating-multiple-array-calculations/27419 "2019-08-13T10:48:09Z")

</div>

This is maybe more of a software design question than performance, or perhaps more adequate to Domains-Optimization category. I also don’t know if any available packages like JuMP or Flux could solve this for me already …

---

## [Segfault with SIMD.jl and BenchmarkTools.jl](https://discourse.julialang.org/t/segfault-with-simd-jl-and-benchmarktools-jl/27352)

<div class="topic-metadata">

**Author:** [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Replies:** 6\
**Last updated:** [August 10, 2019, 1:59am UTC](https://discourse.julialang.org/t/segfault-with-simd-jl-and-benchmarktools-jl/27352 "2019-08-10T01:59:08Z")

</div>

Hi, I try to learn how to use SIMD.jl and the following snippet produces a segmentation fault when I use @btime. using BenchmarkTools using SIMD const SBS=8 function microaxpy\_simd!(ys::Vector{T}, a::T, xs::Vector{T…

---

## [Simple tutorial for PackageCompiler sysimage build?](https://discourse.julialang.org/t/simple-tutorial-for-packagecompiler-sysimage-build/27349)

<div class="topic-metadata">

**Author:** [@LaurentPlagne](https://discourse.julialang.org/u/LaurentPlagne)\
**Replies:** 0\
**Last updated:** [August 9, 2019, 10:25am UTC](https://discourse.julialang.org/t/simple-tutorial-for-packagecompiler-sysimage-build/27349 "2019-08-09T10:25:20Z")

</div>

Hi I cannot make Julia produce AVX2 instructions (ymm registers) on my machine. I use to build the sysimage before PackageCompiler arrival but now it seems that the documentation is a bit broken for this feature. I am…

---

## [Efficiently traverse binary tree represented as tuple of tuples](https://discourse.julialang.org/t/efficiently-traverse-binary-tree-represented-as-tuple-of-tuples/26989)

<div class="topic-metadata">

**Author:** [@non-Jedi](https://discourse.julialang.org/u/non-Jedi)\
**Replies:** 9\
**Last updated:** [August 7, 2019, 2:25am UTC](https://discourse.julialang.org/t/efficiently-traverse-binary-tree-represented-as-tuple-of-tuples/26989 "2019-08-07T02:25:51Z")

</div>

I’m trying to see if I can squeeze out a bit more performance from the Julia implementation of the computer language benchmark game binary trees test. One thing I noticed was that I could create binary trees very fas…

---

## [Calculate SVM dual loss effeciently](https://discourse.julialang.org/t/calculate-svm-dual-loss-effeciently/27171)

<div class="topic-metadata">

**Author:** [@Charlie\_He](https://discourse.julialang.org/u/Charlie_He)\
**Replies:** 0\
**Last updated:** [August 5, 2019, 10:12am UTC](https://discourse.julialang.org/t/calculate-svm-dual-loss-effeciently/27171 "2019-08-05T10:12:30Z")

</div>

I am trying to implement a SVM dual optimization problem in Julia. My data set is the 60000x784 MNIST number recognition dataset. Here are my functions for The linear version is very fast: function dual\_loss(α::Vec, X:…

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

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