[Lemon-commits] [lemon_svn] alpar: r1011 - hugo/trunk/src/benchmark
Lemon SVN
svn at lemon.cs.elte.hu
Mon Nov 6 20:42:43 CET 2006
Author: alpar
Date: Wed Aug 4 20:51:51 2004
New Revision: 1011
Modified:
hugo/trunk/src/benchmark/bfs-bench.cc
Log:
- Trimmed in order to work with gcc-3.4
- The number of executions of the tests can be controlled by command arg.
Modified: hugo/trunk/src/benchmark/bfs-bench.cc
==============================================================================
--- hugo/trunk/src/benchmark/bfs-bench.cc (original)
+++ hugo/trunk/src/benchmark/bfs-bench.cc Wed Aug 4 20:51:51 2004
@@ -38,7 +38,7 @@
using namespace std;
- typename Graph::NodeMap<bool> visited(G,false);
+ typename Graph::template NodeMap<bool> visited(G,false);
queue<typename Graph::Node> Q;
@@ -63,7 +63,7 @@
using namespace std;
- typename Graph::NodeMap<bool> visited(G,false);
+ typename Graph::template NodeMap<bool> visited(G,false);
int N=G.nodeNum();
vector<typename Graph::Node> Q(N);
@@ -84,6 +84,18 @@
} while(Qt!=Qh);
}
+template<class Graph>
+void iteratorBench(Graph &G)
+{
+ GRAPH_TYPEDEF_FACTORY(Graph);
+
+ int i=0;
+
+ for(NodeIt n(G);G.valid(n);G.next(n))
+ for(OutEdgeIt e(G,n);G.valid(e);G.next(e))
+ i++;
+}
+
int main(int argc, char *argv[])
{
// typedef ListGraph Graph;
@@ -96,12 +108,13 @@
Timer T;
- if(argc!=2) {
- cout << "Usage: " << argv[0] << " dim\n";
+ if(argc!=3) {
+ cout << "Usage: " << argv[0] << " dim mul\n";
return 1;
}
int dim=atoi(argv[1]);
+ int mul=atoi(argv[2]);
// cout << "Creating Hipercube ("<< (1<<dim) << " nodes, "
// << dim*(1<<dim) << " edges):";
@@ -114,14 +127,22 @@
T.reset();
{
- for(int i=0;i<50000;i++)
+ for(int i=0;i<mul;i++)
bfsStlQueue(G,nodes[0]);
}
PrintTime("BFS-STL",T);
T.reset();
{
- for(int i=0;i<50000;i++)
+ for(int i=0;i<mul;i++)
bfsOwnQueue(G,nodes[0]);
}
PrintTime("BFS-OWN",T);
+ T.reset();
+ {
+ for(int i=0;i<mul;i++)
+ iteratorBench(G);
+ }
+ PrintTime("ITERATE",T);
+
+
}
More information about the Lemon-commits
mailing list