5 ms·
Zig is adding native vectors including operator support, there are some recent issues/prs about this topic. The general technique of SoA is pretty useful both
by awesan 3mo ago
Zig is adding native vectors including operator support, there are some recent issues/prs about this topic.
The general technique of SoA is pretty useful both in games and other applications, but of course I cannot speak to the specific use-case you are describing.
- nvme0n1p1 3mo agoZig vectors force data into SIMD registers even if that would make the code slower. They're a specialty type. You should only reach for vectors if you would have used SIMD intrinsics in C for example.
- e4m2 3mo agoZig vectors do not necessarily force data into SIMD registers; a scalar implementation would work equally well. This is not just a theoretical argument, because Zig code that uses `@Vector` also has to compile for architectures that do not have SIMD instructions. That being said, the parent commenter is actually referring to other recent proposals as opposed to existing `@Vector` functionality: https://codeberg.org/ziglang/zig/issues/32032 https://codeberg.org/ziglang/zig/issues/32032 https://codeberg.org/ziglang/zig/issues/35376 https://codeberg.org/ziglang/zig/issues/35376
- nvme0n1p1 3mo agoInteresting, so zig might have both "vectors" and "vecs"? I guess naming is another thing to fix before 1.0 <g>