Thu Feb 21 10:37:45 CET 2002
I'll answer my own question :)
A big number represented as a binary has a fixed overhead of a 1 word
compared to the big number itself.
And there is no easy way to do a binary-and of two binaries.
The only way I can think of is:
ASize = size(A)*8,
BSize = size(B)*8,
<<AI:ASize>> = A,
<<BI:BSize>> = B,
AI band BI.
which is obviously less efficient than
A band B.
From: Chandrashekhar Mullaparthi
Sent: 19 February 2002 13:34
Subject: Big numbers
I have a record in which one of the elements is a bitmap which can be about
a 100 bits long. Is it more efficient to store the bitmap as a binary or as
a number in Mnesia. I will be storing millions of these records.
The only operation I will be doing on these bitmaps is checking whether
certain bits are set. If using numbers I can use the "band" operator. Is
there any computation overhead when dealing with big numbers compared to
dealing with binaries in this aspect.
NOTICE AND DISCLAIMER:
This email (including attachments) is confidential. If you have received
this email in error please notify the sender immediately and delete this
email from your system without copying or disseminating it or placing any
reliance upon its contents. We cannot accept liability for any breaches of
confidence arising through use of email. Any opinions expressed in this
email (including attachments) are those of the author and do not necessarily
reflect our opinions. We will not accept responsibility for any commitments
made by our employees outside the scope of our business. We do not warrant
the accuracy or completeness of such information.
More information about the erlang-questions