Who is the fastest?

[SIMD-Crosslang]:


So this one bridged off my ChaCha project from earlier. I know most who know coding/programming will probably tell me its already known, but I went on a little discovery journey for SIMD, Assembly, and cross code comparison.

I had to update my benchmark tool, and also went about with codegen to disassemble what different varying functions were telling the machine. I did this because I was genuinely curious why does one language look ‘faster’ than another? I learned most low level languages use LLVM or allow custom assembly. Even then, custom writing assembly doesnt always = speed. So ‘speed’ is moot, almost all the languages generate the same final commands to the CPU. The biggest differences are the hardware, and the way the code is written (what format the data is processed). In the end, I came to the conclusion that Rust and Zig are contenders, but Zig is the one that feels it offers a bit more freedom (with risk).

Bear in mind I’ve never gone to schooling for this, so Im learning as I go with LLM assistance and research. I just wanted to post what I found/learned and created in case anyone else was ever curious. If Im completely wrong, feel free to let me know! I like to experiment and learn.

https://codeberg.org/AstraLibernis/portable-simd-crosslang
https://codeberg.org/AstraLibernis/zimd

Supported Zig versions

what versions are supported?
Zig 0.16.0

AI / LLM usage disclosure

LLM generated, Human directed

1 Like

I ran the functions created on my Ryzen to try and measure how they work (just the functions). That’s where I found the interesting points that some AVX-512 just doesnt beat scalar, theyre equivalent or worse. But sometimes its worse on L1-L3 and better in RAM. All pointing back to the fact its not a coding language that makes something fast or not, its how the data is being processed, how much data there is, and if the data is clean/organized to be memory efficient.