Skip to content

Add custom dump to SIMD vectors#165

Open
x-sheep wants to merge 1 commit into
pointfreeco:mainfrom
x-sheep:simd
Open

Add custom dump to SIMD vectors#165
x-sheep wants to merge 1 commit into
pointfreeco:mainfrom
x-sheep:simd

Conversation

@x-sheep

@x-sheep x-sheep commented May 18, 2026

Copy link
Copy Markdown
Contributor

Before:

SIMD4(
  _storage: Float.SIMD4Storage(_value: (Opaque Value))
)

After:

SIMD4<Float>(1.0, 2.0, 4.0, 8.0)

@mbrandonw

Copy link
Copy Markdown
Member

Hi @x-sheep, thanks for looking into this! Can you explain your use case for this a bit? Is printing all the values on a single line give you the best experience when inspecting the dump? Or would it have been better to have each value on a new line, like if the mirror was of display style .collection or .tuple?

@x-sheep

x-sheep commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

Most vectors will be 4 items or less, in which case it's preferable to keep them on the same line. The current display style also has the benefit of outputting valid Swift code, unlike .tuple.

My use case involves the simd_float4x4 type (which is part of Accelerate, and not the cross-platform standard library). Having the values spread across 16 lines would make these dumps almost unreadable. With this PR, it auto-mirrors to 4 different SIMD values which get one line each, which is much more pleasant to read.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants