public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Harald Anlauf <anlauf@gmx.de>
To: FX <fxcoudert@gmail.com>, fortran@gcc.gnu.org
Subject: Re: [patch] Fix PR libfortran/95177, ctype.h functions should not be called with char arguments
Date: Fri, 17 Dec 2021 21:40:22 +0100	[thread overview]
Message-ID: <fe61003f-4298-156e-b56f-8fc070e22218@gmx.de> (raw)
In-Reply-To: <3E9B9488-2CE8-485D-82CD-672DBDE7797D@gmail.com>

Hi FX,

Am 17.12.21 um 00:34 schrieb FX via Fortran:
>> 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.

yes, it does!

> 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?

I can't really answer that, but it appears that having __int128 support
requires a 64bit platform.  How common was that in 2004 when itoa was
added to libgfortran?  Do people who care about performance write lots
of formatted integers?  ;-)

> 2. Why is gfc_xtoa() in runtime/error.c? We should probably move it.

Based on the logs itoa was moved around between files, but xtoa
wasn't.  gfc_xtoa is only used in one file: write.c.

> Cheers,
> FX
>

Harald

WARNING: multiple messages have this Message-ID
From: Harald Anlauf <anlauf@gmx.de>
To: fortran@gcc.gnu.org
Subject: Re: [patch] Fix PR libfortran/95177, ctype.h functions should not be called with char arguments
Date: Fri, 17 Dec 2021 21:40:22 +0100	[thread overview]
Message-ID: <fe61003f-4298-156e-b56f-8fc070e22218@gmx.de> (raw)
Message-ID: <20211217204022.jfshSFgcvh_PX2GA1fwI9WIl2v1ZCISYN-IBU9Fq6tc@z> (raw)
In-Reply-To: <3E9B9488-2CE8-485D-82CD-672DBDE7797D@gmail.com>

Hi FX,

Am 17.12.21 um 00:34 schrieb FX via Fortran:
>> 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.

yes, it does!

> 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?

I can't really answer that, but it appears that having __int128 support
requires a 64bit platform.  How common was that in 2004 when itoa was
added to libgfortran?  Do people who care about performance write lots
of formatted integers?  ;-)

> 2. Why is gfc_xtoa() in runtime/error.c? We should probably move it.

Based on the logs itoa was moved around between files, but xtoa
wasn't.  gfc_xtoa is only used in one file: write.c.

> Cheers,
> FX
> 

Harald


  reply	other threads:[~2021-12-17 20:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-16 20:22 FX
2021-12-16 21:00 ` Harald Anlauf
2021-12-16 21:47 ` FX
2021-12-16 23:34   ` FX
2021-12-17 20:40     ` Harald Anlauf [this message]
2021-12-17 20:40       ` Harald Anlauf
2021-12-18 12:54     ` Thomas Koenig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fe61003f-4298-156e-b56f-8fc070e22218@gmx.de \
    --to=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=fxcoudert@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).