summaryrefslogtreecommitdiff
path: root/core/test_vector_speed.cpp
blob: 257e8f33625ec4c2a6b16ca520913572f2e1d50b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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
}
contact: Jan Huwald // Impressum