From: | "Joel Jacobson" <joel(at)compiler(dot)org> |
---|---|
To: | "Dean Rasheed" <dean(dot)a(dot)rasheed(at)gmail(dot)com> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Optimising numeric division |
Date: | 2024-08-25 09:32:38 |
Message-ID: | 0ecb9e14-b979-47a2-a403-b600e561dc22@app.fastmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, Aug 24, 2024, at 14:10, Dean Rasheed wrote:
> On Sat, 24 Aug 2024 at 08:26, Joel Jacobson <joel(at)compiler(dot)org> wrote:
>>
>> On Sat, Aug 24, 2024, at 01:35, Joel Jacobson wrote:
>> > On Sat, Aug 24, 2024, at 00:00, Joel Jacobson wrote:
>> >> Since statistical tools that rely on normal distributions can't be used,
>> >> let's look at the individual measurements for (var1ndigits=3, var2ndigits=3)
>> >> since that seems to be the biggest slowdown on both CPUs,
>> >> and see if our level of surprise is affected.
>> >
>> > Here is a more traditional benchmark,
>> > which seems to also indicate (var1ndigits=3, var2ndigits=3) is a bit slower:
>>
>> I tested just adding back div_var_int64, and it seems to help.
>>
>
> Thanks for testing.
>
> There does appear to be quite a lot of variability between platforms
> over whether or not div_var_int64() is a win for 3 and 4 digit
> divisors. Since this patch is primarily about improving div_var()'s
> long division algorithm, it's probably best for it to not touch that,
> so I've put div_var_int64() back in for now. We could possibly
> investigate whether it can be improved separately.
>
> Looking at your other test results, they seem to confirm my previous
> observation that exact mode is faster than approximate mode for
> var2ndigits <= 12 or so, so I've added code to do that.
>
> I also expanded on the comments for the quotient-correction code a bit.
Nice. LGTM.
I've successfully tested the new patch again on both Intel and AMD.
I've marked it as Ready for Committer.
Regards,
Joel
From | Date | Subject | |
---|---|---|---|
Previous Message | Tom Lane | 2024-08-24 18:17:20 | Re: Optimize mul_var() for var1ndigits >= 8 |