On Sun, 22 Jan 2023 at 22:49, Joel Jacobson wrote:
>
> Many thanks for feedback. Nice catch! New patch attached.
>
Cool, that resolves the performance issues I was seeing for smaller
divisors (which also had a noticeable impact on the numeric_big
regression test).
After some more testing, the
On Mon, 23 Jan 2023 at 05:06, John Naylor wrote:
>
> According to Agner's instruction tables [1], integer division on Skylake (for
> example) has a latency of 26 cycles for 32-bit operands, and 42-95 cycles for
> 64-bit.
>
> [1] https://www.agner.org/optimize/instruction_tables.pdf
>
Thanks,
On Sun, Jan 22, 2023 at 10:42 PM Joel Jacobson wrote:
> I did write the code like you suggest first, but changed it,
> since I realised the extra "else if" needed could be eliminated,
> and thought div_var_int64() wouldn't be slower than div_var_int() since
> I thought 64-bit instructions in
On Sun, Jan 22, 2023, at 14:25, Dean Rasheed wrote:
> I just modified the previous test you posted:
>
> \timing on
> SELECT count(numeric_div_volatile(1e131071,123456)) FROM
> generate_series(1,1e4);
>
> Time: 2048.060 ms (00:02.048)-- HEAD
> Time: 2422.720 ms (00:02.423)-- With patch
>
On Sun, 22 Jan 2023 at 15:41, Joel Jacobson wrote:
>
> On Sun, Jan 22, 2023, at 11:06, Dean Rasheed wrote:
> > Seems like a reasonable idea, with some pretty decent gains.
> >
> > Note, however, that for a divisor having fewer than 5 or 6 digits,
> > it's now significantly slower because it's
On Sun, Jan 22, 2023, at 11:06, Dean Rasheed wrote:
> Seems like a reasonable idea, with some pretty decent gains.
>
> Note, however, that for a divisor having fewer than 5 or 6 digits,
> it's now significantly slower because it's forced to go through
> div_var_int64() instead of div_var_int() for
On Sun, 22 Jan 2023 at 13:42, Joel Jacobson wrote:
>
> Hi,
>
> On platforms where we support 128bit integers, we could accelerate division
> when the number of digits in the divisor is larger than 8 and less than or
> equal to 16 digits, i.e. when the divisor that fits in a 64-bit integer but
>