Open
Description
$ 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.