From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 42650 invoked by alias); 30 Aug 2019 20:05:24 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 42636 invoked by uid 89); 30 Aug 2019 20:05:24 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-3.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=H*f:sk:hpCkHob, H*i:sk:hpCkHob, H*f:sk:CAKqmYP, H*i:WpT X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 30 Aug 2019 20:05:23 +0000 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3DF6BA36EE3; Fri, 30 Aug 2019 20:05:22 +0000 (UTC) Received: from localhost (unknown [10.33.36.20]) by smtp.corp.redhat.com (Postfix) with ESMTP id DD5C21001938; Fri, 30 Aug 2019 20:05:21 +0000 (UTC) Date: Fri, 30 Aug 2019 23:33:00 -0000 From: Jonathan Wakely To: Antony Polukhin Cc: libstdc++ , gcc-patches List Subject: Re: [PATCH] Optimize to_chars Message-ID: <20190830200521.GT9487@redhat.com> References: <20190830160126.GO9487@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett User-Agent: Mutt/1.12.0 (2019-05-25) X-SW-Source: 2019-08/txt/msg02112.txt.bz2 On 30/08/19 22:46 +0300, Antony Polukhin wrote: >пт, 30 авг. 2019 г. в 19:01, Jonathan Wakely : ><...> >> Have you tried comparing the improved code to libc++'s implementation? >> I believe they use precomputed arrays of digits, but they use larger >> arrays that allow 4 bytes to be written at once, which is considerably >> faster (and those precomputed arrays libe in libc++.so not in the >> header). Would we be better off keeping the precomputed arrays and >> expanding them to do 4-byte writes? > >This would not do good for bases 2, 8 and 16. For power of two bases >there is no costly `mod` or `div` instructions, only bit operations. >By increasing the digits table size the cache misses become more >likely. OK, thanks. I'll try benchmarking your improved code against the libc++ version next week.