From: | David Rowley <dgrowleyml(at)gmail(dot)com> |
---|---|
To: | Richard Guo <guofenglinux(at)gmail(dot)com> |
Cc: | PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Strange Bitmapset manipulation in DiscreteKnapsack() |
Date: | 2024-01-18 21:46:51 |
Message-ID: | CAApHDvrfxZkN6u-UddpTCb2C5X1MNmCa8f8N-671Vua+4wvouw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, 18 Jan 2024 at 16:24, David Rowley <dgrowleyml(at)gmail(dot)com> wrote:
> On Thu, 18 Jan 2024 at 15:22, Richard Guo <guofenglinux(at)gmail(dot)com> wrote:
> > Do you think we can use 'memcpy(a, b, BITMAPSET_SIZE(b->nwords))'
> > directly in the new bms_replace_members() instead of copying the
> > bitmapwords one by one, like:
> >
> > - i = 0;
> > - do
> > - {
> > - a->words[i] = b->words[i];
> > - } while (++i < b->nwords);
> > -
> > - a->nwords = b->nwords;
> > + memcpy(a, b, BITMAPSET_SIZE(b->nwords));
> >
> > But I'm not sure if this is an improvement or not.
>
> I considered this earlier but felt it was going against the method
> used in other places in the file. However, on relooking I do see
> bms_copy() does a memcpy().
I feel it's not worth debating the memcpy thing any further, so I've
pushed the v2 patch.
Thanks for reviewing.
David
From | Date | Subject | |
---|---|---|---|
Next Message | Jeff Davis | 2024-01-18 22:03:30 | Re: Built-in CTYPE provider |
Previous Message | David G. Johnston | 2024-01-18 21:44:35 | Re: ALTER ROLE documentation improvement |