[m-rev.] for review: faster int to decimal string conversion

Zoltan Somogyi zoltan.somogyi at runbox.com
Sun Oct 17 17:09:06 AEDT 2021


2021-10-17 17:03 GMT+11:00 "Julien Fischer" <jfischer at opturion.com>:
>> The original code had the function version of int_to_string forward
>> to the predicate version, which is what the library usually does.
>> Your diff reverses this. Why?
> 
> *_to_string for the other integer types is a function, so for
> consistency with them.  That said, none of other integer types
> has a predicate version.
> 
> I'm happy to swap it back, if that's what you prefer.

No, your reason for switching is valid.

> On another matter, the signature for benchmark_det_io/7 is
> 
>    :- pred benchmark_det_io(pred(T1, T2, T3, T3), T1, T2, T3, T3, int,
>     int).
>    :- mode benchmark_det_io(pred(in, out, di, uo) is det, in, out, di, uo,
>     in, out) is cc_multi.
> 
> Is there some reason we use the type variable T3 for the I/O state argument,
> other than at the time the predicate benchmark_det_io was added, the benchmarking
> module didn't import the io module?

Yes. This way also allows the benchmarking of code that uses other
destructively updated data structures. For example, at one point
the Aditi interface used a transaction handle (that was created at
transaction start and destroyed at transaction end) that also had to be
threaded through database operations in di/uo pairs.

Zoltan.


More information about the reviews mailing list