public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libfortran/98076] New: Increase speed of integer I/O
@ 2020-12-01  6:49 tkoenig at gcc dot gnu.org
  2020-12-01  6:50 ` [Bug libfortran/98076] " tkoenig at gcc dot gnu.org
                   ` (13 more replies)
  0 siblings, 14 replies; 15+ messages in thread
From: tkoenig at gcc dot gnu.org @ 2020-12-01  6:49 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98076

            Bug ID: 98076
           Summary: Increase speed of integer I/O
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libfortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: tkoenig at gcc dot gnu.org
  Target Milestone: ---

Currently, we use GFC_INTEGER_LARGEST for a lot of integer I/O.

One place where things could be improved is gfc_itoa:

const char *
gfc_itoa (GFC_INTEGER_LARGEST n, char *buffer, size_t len)
{
...
  GFC_UINTEGER_LARGEST t;
...
  t = n;
  if (n < 0)
    {
      negative = 1;
      t = -n; /*must use unsigned to protect from overflow*/
    }
...

  while (t != 0)
    {
      *--p = '0' + (t % 10);
      t /= 10;
    }

Currently, the quotient / remainder calculation is expanded into
a libcall.  This could be done by the improved remainder calculation
from PR97459 with the calculation of the quotient by multiplicative
inverse, and by switching to a smaller datatype once the value fits in
there.  Both can and should be combined, of course.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-12-27 21:59 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-01  6:49 [Bug libfortran/98076] New: Increase speed of integer I/O tkoenig at gcc dot gnu.org
2020-12-01  6:50 ` [Bug libfortran/98076] " tkoenig at gcc dot gnu.org
2021-04-16 16:22 ` tkoenig at gcc dot gnu.org
2021-04-27 11:39 ` jakub at gcc dot gnu.org
2021-07-28  7:05 ` rguenth at gcc dot gnu.org
2021-07-29 19:18 ` anlauf at gcc dot gnu.org
2021-12-16 21:31 ` fxcoudert at gcc dot gnu.org
2021-12-16 21:40 ` fxcoudert at gcc dot gnu.org
2021-12-16 23:20 ` fxcoudert at gcc dot gnu.org
2021-12-17  9:05 ` fxcoudert at gcc dot gnu.org
2021-12-25 13:04 ` fxcoudert at gcc dot gnu.org
2021-12-26 11:14 ` fxcoudert at gcc dot gnu.org
2021-12-27 20:13 ` ro at gcc dot gnu.org
2021-12-27 20:25 ` fxcoudert at gcc dot gnu.org
2021-12-27 21:59 ` ro at CeBiTec dot Uni-Bielefeld.DE

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).