From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 12858 invoked from network); 9 Mar 2021 09:11:53 -0000 Received: from mother.openwall.net (195.42.179.200) by inbox.vuxu.org with ESMTPUTF8; 9 Mar 2021 09:11:53 -0000 Received: (qmail 3738 invoked by uid 550); 9 Mar 2021 09:11:51 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Reply-To: musl@lists.openwall.com Received: (qmail 3717 invoked from network); 9 Mar 2021 09:11:51 -0000 Date: Tue, 9 Mar 2021 12:11:37 +0300 (MSK) From: Alexander Monakov To: musl@lists.openwall.com cc: =?ISO-8859-15?Q?=C9rico_Nogueira?= In-Reply-To: <20210309035652.32453-1-ericonr@disroot.org> Message-ID: References: <20210309035652.32453-1-ericonr@disroot.org> User-Agent: Alpine 2.20.13 (LNX 116 2015-12-14) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="168458499-979471859-1615281097=:16269" Subject: Re: [musl] [PATCH v2] add qsort_r. This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --168458499-979471859-1615281097=:16269 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 8BIT On Tue, 9 Mar 2021, Érico Nogueira wrote: > since most discussion around the addition of this function has centered > around the possible code duplication it requires or that qsort would > become much slower if implemented as a wrapper around qsort_r How much is "much slower", did anyone provide figures to support this claim? The extra cost that a wrapper brings is either one indirect jump instruction, or one trivially-predictable conditional branch per one comparator invocation. Constant factor in musl qsort is quite high, I'd be surprised if the extra overhead from one additional branch is even possible to measure. Alexander --168458499-979471859-1615281097=:16269--