Boost logo

Boost Users :

From: Bo Peng (ben.bob_at_[hidden])
Date: 2006-06-02 18:03:11


Dear list,

I am using dynamic_bitset to store a sequence of random 0/1. The
program generates repeatedly 32bit random numbers and assign the
result to a dynamic_bitset.

                                for(UINT i=0; i < m_N; ++i)
                                {
                                        if(bit == block) // generate a block
                                        {
                                                ri = rng().randInt(m_max);
                                                bit = 0;
                                        }
                                        if((ri >> bit) & 0x1)
                                                succ.set(i);
                                        bit++;
                            }
When I profile this program, I surprisingly find out that succ.set(i)
uses >50% of the execution time. Is there anyway I can assign block by
block to dynamic_bitset, or assign sequentially so the position of i
does not have to be calculated each time?

Many thanks in advance.
Bo


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net