Re: HyperLogLog.c and pg_leftmost_one_pos32()

2020-07-30 Thread Jeff Davis
On Thu, 2020-07-30 at 19:16 +0200, Tomas Vondra wrote: > > Essentially: > > initHyperLogLog(&hll, 5) > > for i in 0 .. one billion > >addHyperLogLog(&hll, hash(i)) > > estimateHyperLogLog > > > > The numbers are the same regardless of bwidth. > > > > Before my patch, it takes about 15.6s.

Re: HyperLogLog.c and pg_leftmost_one_pos32()

2020-07-30 Thread Tomas Vondra
On Thu, Jul 30, 2020 at 09:21:23AM -0700, Jeff Davis wrote: On Wed, 2020-07-29 at 17:32 -0700, Peter Geoghegan wrote: How did you test this? What kind of difference are we talking about? Essentially: initHyperLogLog(&hll, 5) for i in 0 .. one billion addHyperLogLog(&hll, hash(i)) estimat

Re: HyperLogLog.c and pg_leftmost_one_pos32()

2020-07-30 Thread Jeff Davis
On Wed, 2020-07-29 at 17:32 -0700, Peter Geoghegan wrote: > How did you test this? What kind of difference are we talking about? Essentially: initHyperLogLog(&hll, 5) for i in 0 .. one billion addHyperLogLog(&hll, hash(i)) estimateHyperLogLog The numbers are the same regardless of bwidt

Re: HyperLogLog.c and pg_leftmost_one_pos32()

2020-07-29 Thread Peter Geoghegan
On Wed, Jul 29, 2020 at 10:08 AM Jeff Davis wrote: > Is there a reason that HyperLogLog doesn't use pg_leftmost_one_pos32()? Yes: HyperLogLog predates pg_leftmost_one_pos32(). > I tried the following patch and some brief performance tests seem to > show an improvement. Makes sense. How did you

HyperLogLog.c and pg_leftmost_one_pos32()

2020-07-29 Thread Jeff Davis
Is there a reason that HyperLogLog doesn't use pg_leftmost_one_pos32()? I tried the following patch and some brief performance tests seem to show an improvement. This came up because my recent commit 9878b643 uses HLL for estimating the cardinality of spill files, which solves a few annoyances wi