On 17.12.21 00:34, FX via Fortran wrote:
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!
Yes indeed.
I’m not sure what use cases people have for writing lots of formatted integers,
but this doesn’t sound too bad.
If there is an obvoius speed-up to be had, we should go for it, for
a) the coolness value and
b) because somebody might need it :-)
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?
Not sure about that. We could reverse-engineer the algorithm,
if necessary (and if we are convinced that it is mathematically
correct :-)
Two questions:
1. This is easy, am I missing something? Some reason why it was never tried
before?
Round tuits seem to have been lacking :-)
2. Why is gfc_xtoa() in runtime/error.c? We should probably move it.
No idea, and yes.