> unrelated PS: I’ve been thinking aloud and benchmarking faster integer I/O 
> for libgfortran at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98076
> Comments are welcome on the proposed design, I think the current proposal is 
> a low-hanging fruit (not risky, much faster).

Quick test integrating the idea into libgfortran, here are the timings to make 
a formatted write of 10 million integers into a string:

- very small value (1), negligible speedup (2.273s to 2.248s)
- small value (1042), speedup of 28% (3.224s to 2.350s)
- huge(0_8), speed up of 50% (5.914s to 2.560s)
- huge(0_16), speed up of 83% (19.46s to 3.31s)

Conclusion: this looks quite interesting! I’m not sure what use cases people 
have for writing lots of formatted integers, but this doesn’t sound too bad.

Further thought: fast 64-bit itoa() implementations, under the MIT license 
(https://github.com/jeaiii/itoa) promise a speed-up of 2 to 10 times compared 
to naive implementation. That could bring us down further, but we probably 
cannot incorporate that, right?

Two questions:

1. This is easy, am I missing something? Some reason why it was never tried 
before?
2. Why is gfc_xtoa() in runtime/error.c? We should probably move it.

Cheers,
FX

Reply via email to