[Gambas-user] Checksum for array and collection

Jussi Lahtinen jussi.lahtinen at gmail.com
Thu Mar 16 21:32:03 CET 2023


For arrays you can use memcmp from libc. Pointer to the array is in the
.data property.
That is the fastest, but it doesn't work for collections.

Jussi


On Thu, Mar 16, 2023 at 6:31 PM Christof Thalhofer <chrisml at deganius.de>
wrote:

> Am 16.03.23 um 15:29 schrieb Martín:
>
> > I has made the check, serialized method is faster that check recursively
> > the content of the Collection but only in the case that the collection
> > has not changed the number of items, in that case it is faster the other
> > method that takes into account if .Count is different from the initial
> > state, if so it does not make sense to make more checks that involve
> > computation, because the collection is already different from the
> > initial state.
> > So the conclusion is that the most efficient is to use serialisation but
> > only if the collection does not change the number of items.
>
> Checksum must work with the data being checked alone.
>
> Comparing the output of '.Count' would assume that it has previously
> stored the counted number. This would be another beast.
>
> Thanks everybody and thank you for the test!
>
> Thank you Benoît for this nice and fast algorithm.
>
> :-)
>
> Alles Gute
>
> Christof Thalhofer
>
> --
> Dies ist keine Signatur
>
>
> ----[ http://gambaswiki.org/wiki/doc/netiquette ]----
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230316/8cb78b5e/attachment.htm>


More information about the User mailing list