Created
August 22, 2018 18:57
-
-
Save Izaron/5005fed4184ee6483699191dc5ef3677 to your computer and use it in GitHub Desktop.
Measure the running time with `time ./test` on Linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <boost/dynamic_bitset.hpp> | |
int maxn = 1e8; | |
int bits = 100; | |
void test1() { | |
boost::dynamic_bitset<> bs(bits, abs(rand())); | |
int a = 0; | |
for (int i = 0; i < maxn; i++) { | |
a += bs.count(); | |
} | |
std::cout << a << std::endl; | |
} | |
int main() { | |
std::cout << boost::dynamic_bitset<>::bits_per_block << std::endl; | |
srand(time(NULL)); | |
test1(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment