Boost logo

Boost :

Subject: Re: [boost] [xint] Boost.XInt formal review
From: Chad Nelson (chad.thecomfychair_at_[hidden])
Date: 2011-03-09 10:19:01


On Tue, 8 Mar 2011 12:13:22 -0800 (PST)
Artyom <artyomtnk_at_[hidden]> wrote:

>>> - Move Semantics:
>>>
>>> It is not clear, and not documented!
>>
>> That's because it's presently not used. The code is all there for
>> it, but it's disabled because the future of Boost.Move was still up
>> in the air when I wrote it.
>>
>> To turn it on, define BOOST_XINT_USE_MOVE before including any XInt
>> headers. [...] I haven't tried it, but that code should work the way
>> you expect with the move code enabled.
>
> Yes adding this define makes it work... So it would be good to have
> it documented :-)

Probably, but it should be a moot point. Boost.Move should make it into
the official distribution before XInt, so I'll turn that on permanently.

> And this is really nice feature. Seems that integer is capable of
> handling all possible styles: copy, copy-on-write, move.
>
> Way to go!

:-)

>>> This is the weakest point of this library, the performance of too
>>> many algorithms is very low [...]
>>
>> A lot of that may be due to pass-by-value instead of const
>> references, rather than the algorithms, which I've already corrected
>> for the next release. I'll be testing that soon, maybe today, along
>> with the CoW/move speeds.
>
> Not so sure because I've tried with cow turned on and off and results
> were almost the same.

Either way, the test results should definitively answer the question,
once I can get to them.

> AFAIK xint uses "naive" multiplication algorithm and probably some
> others.

Yes, that's the first algorithm I'll be looking at, once I've finished
the more urgent stuff.

> [...] I'd suggest to take a look on algorithms that GMP and other use
> and re-implement them.

I'm leery of looking at any GMP code... it's probably pure paranoia,
the GPL can't apply to just *looking* at code, but I'd rather stick to
descriptions to ensure that my code doesn't resemble anyone else's and
nobody can claim that I've copied from them.

>> John Bytheway introduced me to a new primality algorithm that I
>> plan to add.
>
> If you are talking about deterministic primality check (ASK)... Don't
> bother too much, nobody uses them in reality and they have O(scary)
> complexity. It is something like O(n^6) where n is number of digits...
>
> So don't bother. It is the last thing that users would actually need.

Fortunately, it's also the last and lowest thing on my wish-list. ;-)
But I'm curious about the algorithm, and implementing it (someday) is
the best way I know of to understand it better.

-- 
Chad Nelson
Oak Circle Software, Inc.
*
*
*



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