Skip to content

reinterpret(Type, v) performance degrades with -O1 #57228

@NHDaly

Description

@NHDaly
$ julia -O2 -e 'using BenchmarkTools; @btime reinterpret.(NTuple{48,UInt8}, $([(UInt128(1), UInt128(2), UInt128(3)) for _ in 1:1000]));'
  2.719 μs (2 allocations: 46.92 KiB)

$ julia -O1 -e 'using BenchmarkTools; @btime reinterpret.(NTuple{48,UInt8}, $([(UInt128(1), UInt128(2), UInt128(3)) for _ in 1:1000]));'
  15.292 μs (2002 allocations: 171.92 KiB)

We are discussing to extend bitcast to support non-padded (packed) isbits types, and switching to that instead.
Draft PR for that here: #57227.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions