public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "fxcoudert at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug libfortran/98076] Increase speed of integer I/O Date: Thu, 16 Dec 2021 21:31:09 +0000 [thread overview] Message-ID: <bug-98076-4-1U8PbSIg4o@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-98076-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98076 Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fxcoudert at gcc dot gnu.org --- Comment #4 from Francois-Xavier Coudert <fxcoudert at gcc dot gnu.org> --- Benchmarking of the formatting of 100 million times a value of the order of medium-sized number (INT_MAX/2) by gfc_itoa. On the 64-bit target I have at hand (aarch64-apple-darwin), depending on whether the function is implemented as: __int128 : 3.91 seconds int64_t : 0.86 seconds int32_t : 0.84 seconds __int128 relies on a function call of the division (___divti3), others don't. This would allow for a very simple optimisation, that does not require to change the current I/O workflow, i.e., passing all integer values as the largest type (usually int128_t): - have a fast itoa64() function that takes an uint64_t arg - have gfc_itoa() call itoa64() if the argument fits - otherwise, divide by a large power of ten, and recursively apply itoa64() For small values, itoa64() will be called once per gfc_itoa() call. Worst case behaviour (very large 128-bit values) is 2 division calls to itoa64(), which is still faster than doing the 38 128-bit divisions in the current version.
next prev parent reply other threads:[~2021-12-16 21:31 UTC|newest] Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-12-01 6:49 [Bug libfortran/98076] New: " 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 [this message] 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
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=bug-98076-4-1U8PbSIg4o@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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: linkBe 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).