That sounds interesting. I quickly looked up the peak read of the L1D cache to be 192 GB/s, is that what's meant here? Or some other, more fundamental microarchitectural limit?
Is it possible to saturate that throughput and still have optimality to gain in some other aspect?
With that we should be pretty much be as fast as Rust, see: https://www.reddit.com/r/rust/comments/1yamcov/looking_for_f...
I don't think I'll be able to reach 192 GB/s if that's the limit of the M3 Air, but even if, unfortunately, validation is slowed down by any subsequent conversion to a String.
I should write about this because all languages suffer from this. I imagine that one day we will have languages that provide more extensive static ownership guarantees where we can have zero cost wrappers over regions of memory that we can easily treat as Strings instead of having to allocate memory and copy the bytes over to a materialized String.
Panzerschrek•21h ago
It's not an optimization, in many cases it's a pessimization if a large string has non-ASCII characters right at the start (or close to it). Iterating only a small fraction of the given string with branching is faster than iterating it all without branching.
modulovalue•21h ago