summaryrefslogtreecommitdiff
path: root/core/test_index_speed.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/test_index_speed.cpp')
-rw-r--r--core/test_index_speed.cpp39
1 files changed, 39 insertions, 0 deletions
diff --git a/core/test_index_speed.cpp b/core/test_index_speed.cpp
new file mode 100644
index 0000000..dfcca24
--- /dev/null
+++ b/core/test_index_speed.cpp
@@ -0,0 +1,39 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "index.hpp"
+#include "index_global.hpp"
+#include "index_spike.hpp"
+#include "perftools.hpp"
+#include "simlimits.hpp"
+
+int main() {
+ Timer *timer;
+ Index<GlobalMsg> g;
+ Index<Spike> s;
+
+
+ timer = new Timer();
+ const int gcount = 10000000;
+ for (int i=0; i<gcount; i++)
+ g.add(i);
+ print_throughput(timer->diff(), gcount, (char*) "global add\t");
+
+ timer = new Timer();
+ for (int i=0; i<gcount; i++)
+ g.last(i);
+ print_throughput(timer->diff(), gcount,(char*) "global search\t");
+
+ timer = new Timer();
+ const int scount = 10000000;
+ for (int i=0; i<scount; i++)
+ s.add(((double) i / 10 / maxNeurons), Ptr<Neuron>(i%maxNeurons));
+ print_throughput(timer->diff(), scount,(char*) "spike add\t");
+
+ timer = new Timer();
+ for (int i=0; i<scount; i++)
+ s.last(((double) scount / 10 / maxNeurons), Ptr<Neuron>(i%maxNeurons));
+ print_throughput(timer->diff(), scount,(char*) "spike search\t");
+
+ return 0; // user has to control the files
+}
contact: Jan Huwald // Impressum