Readit News logoReadit News
Laiho commented on F-strings for C++26 proposal [pdf]   open-std.org/jtc1/sc22/wg... · Posted by u/HeliumHydride
Laiho · 7 months ago
Is it a coincidence that all these quality life things start to pop up after C++ is facing real competition for the first time? Seems a bit odd to add print after using std::out for 30 years.
Laiho commented on C is not suited to SIMD (2019)   blog.vmchale.com/article/... · Posted by u/zetalyrae
Const-me · 7 months ago
I would rather conclude that automatic vectorizers are still less than ideal, despite SIMD instructions have been widely available in commodity processors for 25 years now.

The language is actually great with SIMD, you just have to do it yourself with intrinsics, or use libraries. BTW, here’s a library which implements 4-wide vectorized exponent functions for FP32 precision on top of SSE, AVX and NEON SIMD intrinsics (MIT license): https://github.com/microsoft/DirectXMath/blob/oct2024/Inc/Di...

Laiho · 7 months ago
I've had great success with autovectorization in Rust. Majority of non-branching loops seem to consistently generate great assembly.
Laiho commented on Branchless UTF-8 Encoding   cceckman.com/writing/bran... · Posted by u/vortex_ape
PhilipRoman · 7 months ago
Last time I tested branchless UTF-8 algorithms, I came to the conclusion that they only perform [slightly] better for text consisting of foreign multibyte characters. Unless you expect lots of such inputs on the hot path, just go with traditional algorithms instead. Even in the worst case the difference isn't that big.

Sometimes people fail to appreciate how insanely fast a predictable branch really is.

Laiho · 7 months ago

  fn validate_ascii(bytes: &[u8]) -> bool{
      bytes.iter().fold(true, |acc, b| acc & (\*b <= 127))
  }
This check will likely be the best for english text/code. You can check in varying size chunks depending on how common you think non-ascii will be. If its ascii you can move 128 bytes forward on avx2 in a couple of cycles.

Laiho commented on Dissecting the gzip format (2011)   infinitepartitions.com/ar... · Posted by u/solannou
Laiho · a year ago
If you prefer reading Python, I implemented the decompressor not too long ago: https://github.com/LaihoE/tiralabra
Laiho commented on Cold showers on overhyped topics (2017)   github.com/hwayne/awesome... · Posted by u/troupo
Laiho · 2 years ago
I've been wondering what is the "new" innovation about concurrency is in Go? Since most languages provide some type of channel/lightweight thread, what is the hype all about? I don't think Go makes the "hard" stuff in concurrency any easier, mainly the easy stuff becomes very easy, but in concurency most your time is spent in the "hard" parts.

u/Laiho

KarmaCake day20November 11, 2022View Original