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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
// $Id: KernelClone_bench.C,v 1.4 2002/12/21 16:46:18 oliver Exp $
#include <BALLBenchmarkConfig.h>
#include <BALL/CONCEPT/benchmark.h>
///////////////////////////
#include <BALL/KERNEL/system.h>
#include <BALL/FORMAT/PDBFile.h>
#include <BALL/STRUCTURE/fragmentDB.h>
///////////////////////////
using namespace BALL;
START_BENCHMARK(KernelIteration, 1.0, "$Id: KernelClone_bench.C,v 1.4 2002/12/21 16:46:18 oliver Exp $")
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
PDBFile infile(BALL_BENCHMARK_DATA_PATH(AmberFF_bench.pdb));
System S1;
infile >> S1;
infile.close();
System S;
Molecule* M = new Molecule;
S.insert(*M);
for (Position i = 0; i < 700; i++)
{
M->insert(*new Atom);
}
START_SECTION(Cloning w/o bonds, 1.0)
for (int count = 0; count < 200; count++)
{
System S2;
START_TIMER
S2 = *static_cast<System*>(S.create(true));
STOP_TIMER
S2.clear();
}
END_SECTION
AtomIterator it(M->beginAtom());
Atom* last = &*it;
for (++it; +it; ++it)
{
it->createBond(*last);
last = &*it;
}
START_SECTION(Cloning, 1.0)
for (int count = 0; count < 200; count++)
{
System S2;
START_TIMER
S2 = *static_cast<System*>(S.create(true));
STOP_TIMER
S2.clear();
}
END_SECTION
START_SECTION(Creation, 1.0)
for (int count = 0; count < 300; count++)
{
for (int i = 0; i < 700; i++)
{
START_TIMER
Atom* a = new Atom;
STOP_TIMER
delete a;
}
}
END_SECTION
START_SECTION(Assignment, 1.0)
for (int count = 0; count < 200; count++)
{
Atom atom;
for (int i = 0; i < 700; i++)
{
Atom* a = new Atom;
START_TIMER
*a = atom;
STOP_TIMER
delete a;
}
}
END_SECTION
START_SECTION(Cloning (create), 1.0)
for (int count = 0; count < 300; count++)
{
Atom atom;
for (int i = 0; i < 700; i++)
{
Atom* a;
START_TIMER
a = (Atom*)atom.create();
STOP_TIMER
delete a;
}
}
END_SECTION
START_SECTION(Insertion, 1.0)
for (int count = 0; count < 300; count++)
{
for (int i = 0; i < 700; i++)
{
Molecule M;
Atom* a = new Atom;
START_TIMER
M.insert(*a);
STOP_TIMER
}
}
END_SECTION
AtomIterator ai(S.beginAtom());
for (; +ai; ++ai)
{
ai->destroyBonds();
}
START_SECTION(Deleting, 1.0)
for (int count = 0; count < 200; count++)
{
System S2;
S2 = *static_cast<System*>(S.create(true));
START_TIMER
S2.destroy();
STOP_TIMER
}
END_SECTION
/////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////
END_BENCHMARK
|