[libcxx-commits] [PATCH] D128215: [libc++] Reduces std::to_chars instantiations.

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Jun 20 10:58:42 PDT 2022


philnik added a comment.

> Yes we still support 32-bit platforms, using a 64-bit value there would give a performance penalty, especially on platforms with a small number or registers.

Isn't `size_t` 32 bits wide on 32-bit platforms?

> Another reason why I prefer 32-bits is that I'm quite sure that division of a 32-bit value by a constant is more efficient than the division of a 64-bit value. (The compiler will transform it in a multiplication and a shift which IIRC always fits in a 64-bit register, when using a 32-bit value.) This is what we're doing for base 10.

Could you do a benchmark to check if using a 32-bit wide instantiation yields better performance even on 64-bit platforms?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128215/new/

https://reviews.llvm.org/D128215



More information about the libcxx-commits mailing list