On Wed, 2 Aug 2023 at 01:26, Dean Rasheed <dean.a.rash...@gmail.com> wrote:
>
> On Tue, 1 Aug 2023 at 13:55, David Rowley <dgrowle...@gmail.com> wrote:
> >
> > I tried adding the "at least 1 digit check" by adding an else { goto
> > slow; } in the above code, but it seems to generate slower code than
> > just checking if (unlikely(ptr == s)) { goto slow; } after the loop.
> >
>
> That check isn't quite right, because "ptr" will not equal "s" if
> there is a sign character, so it won't detect an input with no digits
> in that case.

Ah, yeah. Thanks.

Here's a patch with an else condition when the first digit check fails.

master + fastpath4.patch:
latency average = 1579.576 ms
latency average = 1572.716 ms
latency average = 1563.398 ms

(appears slightly faster than fastpath3.patch)

David

Attachment: pg_strtoint_fastpath4.patch
Description: Binary data

Reply via email to