Re: Strange Bitmapset manipulation in DiscreteKnapsack()
| От | David Rowley |
|---|---|
| Тема | Re: Strange Bitmapset manipulation in DiscreteKnapsack() |
| Дата | |
| Msg-id | CAApHDvrfxZkN6u-UddpTCb2C5X1MNmCa8f8N-671Vua+4wvouw@mail.gmail.com обсуждение исходный текст |
| Ответ на | Re: Strange Bitmapset manipulation in DiscreteKnapsack() (David Rowley <dgrowleyml@gmail.com>) |
| Список | pgsql-hackers |
On Thu, 18 Jan 2024 at 16:24, David Rowley <dgrowleyml@gmail.com> wrote:
> On Thu, 18 Jan 2024 at 15:22, Richard Guo <guofenglinux@gmail.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
В списке pgsql-hackers по дате отправления: