From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) by sourceware.org (Postfix) with ESMTPS id 7EA1F3858410 for ; Fri, 17 Dec 2021 20:40:25 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7EA1F3858410 X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from gluon.fritz.box ([79.251.12.234]) by mail.gmx.net (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1Mq2jC-1mCHsj1Cle-00nCPz; Fri, 17 Dec 2021 21:40:23 +0100 Subject: Re: [patch] Fix PR libfortran/95177, ctype.h functions should not be called with char arguments To: FX , fortran@gcc.gnu.org Newsgroups: gmane.comp.gcc.fortran References: <12368AB6-5F89-4EFA-8F12-F422134C099F@gmail.com> <3E9B9488-2CE8-485D-82CD-672DBDE7797D@gmail.com> From: Harald Anlauf Message-ID: Date: Fri, 17 Dec 2021 21:40:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 MIME-Version: 1.0 In-Reply-To: <3E9B9488-2CE8-485D-82CD-672DBDE7797D@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:uNb+3AAFUpKrPD0F5ZMHSAbaseRtGEuQ37pSNCZSgdvUignxELm Khqbw4/v5E7S1/0gs8JkltPnLOCq5Yu4ZnUG17fiBntZeUO5VkjNO/b9Ug9FmBGbXtSly6F VYbuVgHTD8xzx/xO9U+yXvh65Q1JtpwoltmfJqJ8H8s8PjoCdGJ9zuC+qXvqYvPoPfWqrL1 eJiAXpE4nCH5xLGQLkMBQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:ipX83IK8+s4=:SfpH8Zy5RyAPc5zZ8n8sLb hFPyjvq+PC5j+RdXItNgq6x3FIdgjqcvLTPVkIF/Moc82T/LaXeD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ijRSQk= X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, KAM_SHORT, NICE_REPLY_A, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Dec 2021 20:40:27 -0000 Hi FX, Am 17.12.21 um 00:34 schrieb FX via Fortran: >> unrelated PS: I=E2=80=99ve been thinking aloud and benchmarking faster = integer I/O for libgfortran at https://gcc.gnu.org/bugzilla/show_bug.cgi?i= d=3D98076 >> Comments are welcome on the proposed design, I think the current propos= al is a low-hanging fruit (not risky, much faster). > > Quick test integrating the idea into libgfortran, here are the timings t= o 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=E2=80=99m not sure what use = cases people have for writing lots of formatted integers, but this doesn= =E2=80=99t sound too bad. yes, it does! > Further thought: fast 64-bit itoa() implementations, under the MIT licen= se (https://github.com/jeaiii/itoa) promise a speed-up of 2 to 10 times co= mpared to naive implementation. That could bring us down further, but we p= robably cannot incorporate that, right? > > Two questions: > > 1. This is easy, am I missing something? Some reason why it was never tr= ied 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ciao.gmane.io (ciao.gmane.io [116.202.254.214]) by sourceware.org (Postfix) with ESMTPS id 0C25B3858412 for ; Fri, 17 Dec 2021 20:40:34 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 0C25B3858412 Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1myK1n-0002vh-87 for fortran@gcc.gnu.org; Fri, 17 Dec 2021 21:40:31 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: fortran@gcc.gnu.org From: Harald Anlauf 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 Message-ID: References: <12368AB6-5F89-4EFA-8F12-F422134C099F@gmail.com> <3E9B9488-2CE8-485D-82CD-672DBDE7797D@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.12.0 In-Reply-To: <3E9B9488-2CE8-485D-82CD-672DBDE7797D@gmail.com> Content-Language: en-US X-Spam-Status: No, score=-3.8 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, NICE_REPLY_A, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Dec 2021 20:40:35 -0000 Message-ID: <20211217204022.jfshSFgcvh_PX2GA1fwI9WIl2v1ZCISYN-IBU9Fq6tc@z> 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