public inbox for libc-help@sourceware.org
 help / color / mirror / Atom feed
From: Adhemerval Zanella <adhemerval.zanella@linaro.org>
To: Stefan Kanthak <stefan.kanthak@nexgo.de>,
	Szabolcs Nagy <szabolcs.nagy@arm.com>
Cc: libc-help@sourceware.org
Subject: Re: nextafter() about an order of magnitude slower than trivial implementation
Date: Thu, 19 Aug 2021 08:20:49 -0300	[thread overview]
Message-ID: <741b2c48-a754-51c5-cb72-a2f97795e30f@linaro.org> (raw)
In-Reply-To: <BEF317B3F18B447F8BAE9B550BE5C237@H270>



On 18/08/2021 14:11, Stefan Kanthak wrote:
> Szabolcs Nagy <szabolcs.nagy@arm.com> wrote:
> 
>> The 08/16/2021 18:03, Stefan Kanthak wrote:
>>> Testing and benchmarking an exponential function that consumes
>>> about 10ns/call on an AMD EPYC 7262, I noticed that nextafter()
>>> itself is DEAD SLOW: it consumes about 8.5ns/call!
>>>
>>> The following (quick&dirty) implementation consumes 0.7ns/call,
>>> i.e. is about an order of magnitude faster:
>>
>> correctly measuring latency on a modern x86_64 core:
>>
>> musl: 3.16 ns
>> glibc: 5.68 ns
>> your: 5.72 ns

Thanks for bring this up, if you want to contribute a patch please
follow the Contribution checklist [1].  We recently dropped the
requirement of the FSF contribution, so you can use a SCO-like 
license on the patches.

To change the current implementation I suggest you to also provide
a benchmark using glibc benchmark framework.  Some maths functions
provide both latency and reciprocal-throughput information, and
with both numbers we can evaluate if the new implementation is
indeed better on different machines.

I would just like to ask to keep the tone respectful and be open
to suggestion and criticize, so you do not repeat the same derail
thread on musl maillist [1]. Szabolcs and Wilco did an excellent 
job on some newer math functions implementation, you might read 
the old thread to see how was their approach.

[1] https://sourceware.org/glibc/wiki/Contribution%20checklist
[2] https://www.openwall.com/lists/musl/2021/08/15/18

  reply	other threads:[~2021-08-19 11:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-16 16:03 Stefan Kanthak
2021-08-18 12:51 ` Szabolcs Nagy
2021-08-18 17:11   ` Stefan Kanthak
2021-08-19 11:20     ` Adhemerval Zanella [this message]
2021-08-19 17:57       ` [PATCH] " Stefan Kanthak
2021-08-20  9:52       ` [PATCH/2nd version] " Stefan Kanthak
2021-08-20 16:55         ` Joseph Myers
2021-08-20 20:19           ` Stefan Kanthak
2021-08-20 21:03             ` Joseph Myers
2021-08-23 12:50             ` Adhemerval Zanella

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=741b2c48-a754-51c5-cb72-a2f97795e30f@linaro.org \
    --to=adhemerval.zanella@linaro.org \
    --cc=libc-help@sourceware.org \
    --cc=stefan.kanthak@nexgo.de \
    --cc=szabolcs.nagy@arm.com \
    /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: link
Be 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).