Open IntegratedQuantum opened 1 year ago
Are there any known work arounds for this which works with arbitrary Zig types (e.g. which are not valid in packed
/extern
)? I'd really like to be able to return multiple values where some of them could be put into registers.
Zig Version
0.11.0-dev.1201+301a89849
Benchmark program
Benchmark result
As you can see the regular struct is about 7 times slower than the extern and packed structs.
Godbolt
On godbolt you can observe that the packed and extern structs seem to push their values into a single register before returning, while the regular struct puts the values onto the stack which is more expensive.
Bonus
When running the program in debug the regular struct appears to be faster than in ReleaseFast: