Re: refactoring - share str2*int64 functions

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
Cc: Andres Freund <andres(at)anarazel(dot)de>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: refactoring - share str2*int64 functions
Date: 2019-09-02 00:51:01
Message-ID: 20190902005101.GA1841@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Sep 01, 2019 at 08:07:06PM +0200, Fabien COELHO wrote:
> They allow to quickly do performance tests, for me it is useful to keep it
> around, but you are the committer, you do as you feel.

If there are more voices for having that in core, we could consider
it. For now I have added that into my own plugin repository with all
the functions discussed on this thread:
https://github.com/michaelpq/pg_plugins/

> The signed overflows are trickier even, I have not paid attention to the
> fallback code. I agree that it is better left untouched for know.

Thanks.

> Hmmm. I did manual tests really. Attached a psql script replicating them.
>
> # with builtin overflow detection
> sh> psql < oc.sql
> NOTICE: int 16 mul: 00:00:02.747269 # slow
> NOTICE: int 16 add: 00:00:01.83281
> NOTICE: int 16 sub: 00:00:01.8501
> NOTICE: uint 16 mul: 00:00:03.68362 # slower
> NOTICE: uint 16 add: 00:00:01.835294
> NOTICE: uint 16 sub: 00:00:02.136895 # slow
> NOTICE: int 32 mul: 00:00:01.828065
> NOTICE: int 32 add: 00:00:01.840269
> NOTICE: int 32 sub: 00:00:01.843557
> NOTICE: uint 32 mul: 00:00:02.447052 # slow
> NOTICE: uint 32 add: 00:00:01.849899
> NOTICE: uint 32 sub: 00:00:01.840773
> NOTICE: int 64 mul: 00:00:01.839051
> NOTICE: int 64 add: 00:00:01.839065
> NOTICE: int 64 sub: 00:00:01.838599
> NOTICE: uint 64 mul: 00:00:02.161346 # slow
> NOTICE: uint 64 add: 00:00:01.839404
> NOTICE: uint 64 sub: 00:00:01.838549

Actually that's much faster than a single core on my debian SID with
gcc 9.2.1.

Here are more results from me:
Built-in undef Built-in
int16 mul 00:00:05.425207 00:00:05.634417
int16 add 00:00:05.389738 00:00:06.38885
int16 sub 00:00:05.446529 00:00:06.39569
uint16 mul 00:00:05.499066 00:00:05.541617
uint16 add 00:00:05.281622 00:00:06.252511
uint16 sub 00:00:05.366424 00:00:05.457148
int32 mul 00:00:05.121209 00:00:06.154989
int32 add 00:00:05.228722 00:00:06.344721
int32 sub 00:00:05.237594 00:00:06.323543
uint32 mul 00:00:05.126339 00:00:05.921738
uint32 add 00:00:05.212085 00:00:06.183031
uint32 sub 00:00:05.201884 00:00:05.363667
int64 mul 00:00:05.136129 00:00:06.148101
int64 add 00:00:05.200201 00:00:06.329091
int64 sub 00:00:05.218028 00:00:06.313114
uint64 mul 00:00:05.444733 00:00:08.089742
uint64 add 00:00:05.603978 00:00:06.377753
uint64 sub 00:00:05.544838 00:00:05.490873

This part has been committed, now let's move to the next parts of your
patch.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Euler Taveira 2019-09-02 01:25:00 Re: [Patch] Add a reset_computed_values function in pg_stat_statements
Previous Message Tsunakawa, Takayuki 2019-09-02 00:27:09 RE: SIGQUIT on archiver child processes maybe not such a hot idea?