JuliaArrays / JuliaArrays/StaticArrays.jl

`SVector(x...)` slower than `SA[x...]` when `x` is a DataFrameRow

Open
#1,044 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Julia
Stars
844
Forks
159
Avg merge
3d 21h
Merged PRs (30d)
3

Description

I'm seeing 2x slowdown when using SVector() with a DataFrameRow vs. SA[]

using BenchmarkTools, DataFrames

zzz = DataFrame(:x => [1], :y => [2])
@btime SA[zzz[1, :]...]      # 377.735 ns (4 allocations: 160 bytes)
@btime SVector(zzz[1, :]...) # 697.619 ns (6 allocations: 224 bytes)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the BenchmarkTools example with DataFrames, comparing SA[zzz[1, :]...] and SVector(zzz[1, :]...). Trace the two splatting paths in StaticArrays.jl and identify why the DataFrameRow case allocates more; done means the benchmark no longer shows the reported slowdown without changing the result.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
performance
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.