Boost logo

Boost :

Subject: Re: [boost] [xint] Fourth release, requesting preliminary review again
From: Chad Nelson (chad.thecomfychair_at_[hidden])
Date: 2010-06-10 10:05:19


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 06/10/2010 08:15 AM, Giovanni Piero Deretta wrote:

>> [...] I assume you wanted to use stack-based memory for speed, but
>> due to the above, it would likely be slower than the equivalent
>> heap-based integer. Especially with a good caching allocator.
>
> [...] Did you consider separating the big int data structure itself
> from the big int algorithms, a la STL? This way anybody can roll
> their own big int class according to their own need and you need to
> provide only a default one, optimized for the common case. [...]

I've tried making the algorithms independent by having them take an
array and other information, but they need the freedom to reallocate as
necessary (or I'd have to have two functions for each operation). That
means passing them the allocator as well, at the very least. You end up
with four parameters for every integer you need to pass to a function
(bool reference for positive/negative, size_t reference for length,
size_t for max-length, and the magnitude array), plus making it a
template because allocators aren't based on a standard class. Or wasting
time packing and unpacking those same options to and from an
intermediate structure of some kind. It was a lot faster and easier to
pass it as the already-existing raw integer class, which already has
that information plus allocation and other capabilities.
- --
Chad Nelson
Oak Circle Software, Inc.
*
*
*
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkwQ8RwACgkQp9x9jeZ9/wQ27gCg+PKJPzKyY7AZqPpYtUVfUl7G
9IwAoPXB7eU5D3JQtxdA7JNNLDe74gS6
=7k2v
-----END PGP SIGNATURE-----


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk