Date: Fri, 8 Aug 2025 15:23:04 +0000
I would not try to measure with random divisions unless the random is pre-generated and is the exact same numbers on every test.
The amount of time a division takes to complete can vary depending on the input.
You may not actually be measuring the compiler difference on this particular function so much as you are measuring a bias in your random number generator.
________________________________
From: Std-Proposals <std-proposals-bounces_at_[hidden]> on behalf of Hans Åberg via Std-Proposals <std-proposals_at_[hidden]>
Sent: Friday, August 8, 2025 2:31:51 PM
To: Oliver Hunt <oliver_at_[hidden]>
Cc: Hans Åberg <haberg_1_at_[hidden]>; std-proposals_at_[hidden] <std-proposals_at_[hidden]>
Subject: Re: [std-proposals] Multiprecision division
> On 7 Aug 2025, at 23:25, Oliver Hunt <oliver_at_[hidden]> wrote:
>
> You are making the claim that std::span introduces overhead that is not present if the API uses raw pointers.
>
> I just provided you an example showing that the code generation is _identical_.
There is 9–10% overhead with std::span relative to using clang O3 in some 10 million random division runs of the function “div32” calling the “div” function I mentioned. Somewhat less with g++ O3, but it has somewhat worse absolute timings on the “without” variation.
The amount of time a division takes to complete can vary depending on the input.
You may not actually be measuring the compiler difference on this particular function so much as you are measuring a bias in your random number generator.
________________________________
From: Std-Proposals <std-proposals-bounces_at_[hidden]> on behalf of Hans Åberg via Std-Proposals <std-proposals_at_[hidden]>
Sent: Friday, August 8, 2025 2:31:51 PM
To: Oliver Hunt <oliver_at_[hidden]>
Cc: Hans Åberg <haberg_1_at_[hidden]>; std-proposals_at_[hidden] <std-proposals_at_[hidden]>
Subject: Re: [std-proposals] Multiprecision division
> On 7 Aug 2025, at 23:25, Oliver Hunt <oliver_at_[hidden]> wrote:
>
> You are making the claim that std::span introduces overhead that is not present if the API uses raw pointers.
>
> I just provided you an example showing that the code generation is _identical_.
There is 9–10% overhead with std::span relative to using clang O3 in some 10 million random division runs of the function “div32” calling the “div” function I mentioned. Somewhat less with g++ O3, but it has somewhat worse absolute timings on the “without” variation.
-- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
Received on 2025-08-08 15:23:08