[m-rev.] for review: avoid sprintf when converting integers to strings
Julien Fischer
jfischer at opturion.com
Fri Oct 3 17:36:23 AEST 2025
On Fri, 3 Oct 2025 at 16:27, Zoltan Somogyi <zoltan.somogyi at runbox.com> wrote:
> Speed up {int,uint}{,8,16,32,64}_to_string ...
>
> ... when targeting C.
>
> library/string.m:
> On 27 Oct 2021, Julien speed up one of these operations
> by avoiding the use of sprintf. Apply the same technique,
> suitably generalized, to all other similar operations.
> Use macros to reduce the amount of code duplication needed.
>
> runtime/mercury_conf.h.in:
> Fix an old bug: spell MR_MERCURY_IS_{32,64}_BITS correctly,
> to match the name that is (conditionally) defined by configure.
>
> configure.ac:
> Delete references to MERCURY_IS_{32,64}_BITS, which turn out
> to be totally unused.
That's fine. It would be possible to make certain cases faster, e.g.
by using the 2 digit lookup table approach with decimals, but that's
probably not so important for now.
Julien.
More information about the reviews
mailing list