diff options
author | Jan Huwald <jh@sotun.de> | 2012-05-07 20:01:51 (GMT) |
---|---|---|
committer | Jan Huwald <jh@sotun.de> | 2012-05-07 20:01:51 (GMT) |
commit | 420d2ef464d4a741028e132e662d5626806a41f5 (patch) | |
tree | 1aca6eb512e4ed0fb5f3c10c528cb998b6ffd695 /core/test_vector_speed.cpp |
Diffstat (limited to 'core/test_vector_speed.cpp')
-rw-r--r-- | core/test_vector_speed.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/core/test_vector_speed.cpp b/core/test_vector_speed.cpp new file mode 100644 index 0000000..257e8f3 --- /dev/null +++ b/core/test_vector_speed.cpp @@ -0,0 +1,28 @@ +#include <stdio.h> +#include <stdlib.h> + +#include "scalar.hpp" +#include "vector.hpp" +#include "mempool.hpp" +#include "perftools.hpp" + + +int main() { + Timer *timer; + Vector<uint8_t, 1> dense("dense", (uint64_t) 1024 * 1024 * 1024 * 800); + Vector<uint8_t, 1> sparse("sparse", (uint64_t) 1024 * 1024 * 1024 * 800); + + timer = new Timer(); + const int dcount = 100000000; + for (int i=0; i<dcount; i++) + dense.set(i,i%2); + print_throughput(timer->diff(), dcount,(char*) "dense"); + + timer = new Timer(); + const int scount = 100000; + for (int i=0; i<scount; i++) + dense.set(rand(),i%2); + print_throughput(timer->diff(), scount,(char*) "sparse"); + + return 0; // user has to control the files +} |