Re: Change GUC hashtable to use simplehash?

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: John Naylor <johncnaylorls(at)gmail(dot)com>
Cc: Jeff Davis <pgsql(at)j-davis(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Gurjeet Singh <gurjeet(at)singh(dot)im>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Change GUC hashtable to use simplehash?
Date: 2024-01-05 11:58:31
Message-ID: CACJufxHkz13=p5nju7BN2buZsGVN_vFumEMmN3gdtBKssLj4WQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 5, 2024 at 6:54 PM John Naylor <johncnaylorls(at)gmail(dot)com> wrote:
>
> On Thu, Jan 4, 2024 at 10:01 AM jian he <jian(dot)universality(at)gmail(dot)com> wrote:
> >
> > I still cannot git apply your patch cleanly. in
>
> I don't know why you're using that -- the git apply man page even says
>
> "Use git-am(1) to create commits from patches generated by
> git-format-patch(1) and/or received by email."
>
> Or, if that fails, use "patch".
>
> > http://cfbot.cputube.org/ i cannot find your patch.
> > ( so, it might be that I test based on incomplete information).
> > but only hashfn_unstable.h influences bench_hash/bench_hash.c.
> >
> > so I attached the whole patch that I had git applied, that is the
> > changes i applied for the following tests.
>
> Well, aside from the added text-editor detritus, it looks like this
> has everything except v11-0008, without which I still get improvement
> for the pgstat hash.
>
> > Model name: Intel(R) Core(TM) i5-14600K
>
> > The following is tested with another machine, also listed machine spec below.
> > I tested 3 times, the results is very similar as following:
> > select * from bench_cstring_hash_aligned(100000); 4705.686 ms
> > select * from bench_cstring_hash_unaligned(100000); 6835.753 ms
> > select * from bench_pgstat_hash(100000); 2678.978 ms
> > select * from bench_pgstat_hash_fh(100000); 6199.017 ms
> > select * from bench_string_hash(100000); 847.699 ms
>
> I was fully prepared to believe something like 32-bit Arm would have
> difficulty with 64-bit shifts/multiplies etc., but this makes no sense
> at all. In this test, on my machine, HEAD's pgstat_hash is 3x faster
> than HEAD's "strlen + hash_bytes", but for you it's 3x slower. To
> improve reproducibility, I've added the .sql files and a bench script
> to v13. I invite you to run bench_hash.sh and see if that changes
> anything.

git apply has a verbose option.
also personally I based on vscode editor, the color to view the changes.

jian(at)jian:~/Desktop/pg_src/src4/postgres$ git apply
$PATCHES/v13-0006-Add-benchmarks-for-hashing.patch
/home/jian/Downloads/patches/v13-0006-Add-benchmarks-for-hashing.patch:81:
indent with spaces.
if (/^PG_KEYWORD\("(\w+)"/)
/home/jian/Downloads/patches/v13-0006-Add-benchmarks-for-hashing.patch:82:
indent with spaces.
{
/home/jian/Downloads/patches/v13-0006-Add-benchmarks-for-hashing.patch:87:
indent with spaces.
}
/home/jian/Downloads/patches/v13-0006-Add-benchmarks-for-hashing.patch:89:
trailing whitespace.

/home/jian/Downloads/patches/v13-0006-Add-benchmarks-for-hashing.patch:92:
trailing whitespace.

warning: squelched 11 whitespace errors
warning: 16 lines add whitespace errors.

jian(at)jian:~/Desktop/pg_src/src4/postgres$ bash runbench.sh
select * from bench_string_hash(100000);

latency average = 875.482 ms
select * from bench_cstring_hash_unaligned(100000);
latency average = 6539.231 ms
select * from bench_cstring_hash_aligned(100000);
latency average = 4401.278 ms
select * from bench_pgstat_hash(100000);
latency average = 2679.732 ms
select * from bench_pgstat_hash_fh(100000);

latency average = 5711.012 ms
jian(at)jian:~/Desktop/pg_src/src4/postgres$ bash runbench.sh
select * from bench_string_hash(100000);

latency average = 874.261 ms
select * from bench_cstring_hash_unaligned(100000);
latency average = 6538.874 ms
select * from bench_cstring_hash_aligned(100000);
latency average = 4400.546 ms
select * from bench_pgstat_hash(100000);
latency average = 2682.013 ms
select * from bench_pgstat_hash_fh(100000);

latency average = 5709.815 ms

meson:

meson setup ${BUILD} \
-Dprefix=${PG_PREFIX} \
-Dpgport=5459 \
-Dplperl=enabled \
-Dplpython=enabled \
-Dssl=openssl \
-Dldap=enabled \
-Dlibxml=enabled \
-Dlibxslt=enabled \
-Duuid=e2fs \
-Dzstd=enabled \
-Dlz4=enabled \
-Dsystemd=enabled \
-Dcassert=true \
-Db_coverage=true \
-Dicu=enabled \
-Dbuildtype=debug \
-Dwerror=true \
-Dc_args='-Wunused-variable
-Wuninitialized
-Werror=maybe-uninitialized
-Wreturn-type
-DWRITE_READ_PARSE_PLAN_TREES
-DCOPY_PARSE_PLAN_TREES
-DREALLOCATE_BITMAPSETS
-DRAW_EXPRESSION_COVERAGE_TEST -fno-omit-frame-pointer' \
-Ddocs_pdf=disabled \
-Dllvm=disabled \
-Ddocs_pdf=disabled

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2024-01-05 12:15:44 Re: Synchronizing slots from primary to standby
Previous Message Michael Paquier 2024-01-05 11:13:05 Re: Assorted typo fixes