diff options
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 +} |