Go to the documentation of this file.
45 int main(
int argc,
char *argv[])
48 const label nIters = 1000;
54 std::vector<bool> stlVector(
n,
true);
58 for (
label i = 0; i <
n; i++)
67 for (
label i = 0; i <
n; i++)
80 for (
label iter = 0; iter < nIters; ++iter)
86 Info<<
"resize/shrink/resize:" <<
timer.cpuTimeIncrement() <<
" s\n\n";
89 Info<<
"set every other bit on and count\n";
94 for (
label iter = 0; iter < nIters; ++iter)
101 Info<<
"Counting brute-force:" <<
timer.cpuTimeIncrement()
108 for (
label iter = 0; iter < nIters; ++iter)
112 Info<<
"Counting via count():" <<
timer.cpuTimeIncrement()
119 for (
label iter = 0; iter < nIters; ++iter)
126 Info<<
"Dummy loop:" <<
timer.cpuTimeIncrement() <<
" s" <<
endl;
135 for (
label iter = 0; iter < nIters; ++iter)
137 for (
unsigned int i = 0; i < stlVector.size(); i++)
142 Info<<
"Reading stl:" <<
timer.cpuTimeIncrement() <<
" s" <<
endl;
148 for (
label iter = 0; iter < nIters; ++iter)
155 Info<<
"Reading unpacked:" <<
timer.cpuTimeIncrement() <<
" s" <<
endl;
161 for (
label iter = 0; iter < nIters; ++iter)
168 Info<<
"Reading packed using get:" <<
timer.cpuTimeIncrement()
175 for (
label iter = 0; iter < nIters; ++iter)
182 Info<<
"Reading packed using reference:" <<
timer.cpuTimeIncrement()
189 for (
label iter = 0; iter < nIters; ++iter)
196 Info<<
"Reading packed using iterator:" <<
timer.cpuTimeIncrement()
203 for (
label iter = 0; iter < nIters; ++iter)
210 Info<<
"Reading packed using const_iterator():" <<
timer.cpuTimeIncrement()
217 for (
label iter = 0; iter < nIters; ++iter)
224 Info<<
"Reading empty labelHashSet:" <<
timer.cpuTimeIncrement()
231 for (
label iter = 0; iter < nIters; ++iter)
238 Info<<
"Reading full labelHashSet:" <<
timer.cpuTimeIncrement()
245 for (
label iter = 0; iter < nIters; ++iter)
252 Info<<
"Reading empty StaticHash:" <<
timer.cpuTimeIncrement()
260 for (
label iter = 0; iter < nIters; ++iter)
267 Info<<
"Reading full StaticHash:" <<
timer.cpuTimeIncrement()
272 Info<<
"Starting write tests" <<
endl;
279 for (
label iter = 0; iter < nIters; ++iter)
281 for (
unsigned int i = 0; i < stlVector.size(); i++)
286 Info<<
"Writing stl:" <<
timer.cpuTimeIncrement() <<
" s" <<
endl;
289 for (
label iter = 0; iter < nIters; ++iter)
296 Info<<
"Writing unpacked:" <<
timer.cpuTimeIncrement() <<
" s" <<
endl;
300 for (
label iter = 0; iter < nIters; ++iter)
307 Info<<
"Writing packed using reference:" <<
timer.cpuTimeIncrement()
312 for (
label iter = 0; iter < nIters; ++iter)
319 Info<<
"Writing packed using set:" <<
timer.cpuTimeIncrement()
324 for (
label iter = 0; iter < nIters; ++iter)
331 Info<<
"Writing packed using iterator:" <<
timer.cpuTimeIncrement()
336 for (
label iter = 0; iter < nIters; ++iter)
340 Info<<
"Writing packed uniform 0:" <<
timer.cpuTimeIncrement()
345 for (
label iter = 0; iter < nIters; ++iter)
349 Info<<
"Writing packed uniform 1:" <<
timer.cpuTimeIncrement()
356 for (
label iter = 0; iter < nIters; ++iter)
360 Info<<
"Writing packed<3> uniform 0:" <<
timer.cpuTimeIncrement()
365 for (
label iter = 0; iter < nIters; ++iter)
369 Info<<
"Writing packed<3> uniform 1:" <<
timer.cpuTimeIncrement()
Starts timing CPU usage and return elapsed time from start.
int main(int argc, char *argv[])
#define forAllIter(Container, container, iter)
Iterate across all elements in the container object of type.
#define forAll(list, i)
Loop across all elements in list.
List< unsigned int > & storage()
Return the underlying packed storage.
void set(const PackedList< 1 > &)
Set specified bits.
A zero-sized class without any storage. Used, for example, in HashSet.
Ostream & endl(Ostream &os)
Add newline and flush stream.
forAllConstIter(PtrDictionary< phaseModel >, mixture.phases(), phase)
STL conforming hash table.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Ostream & printInfo(Ostream &) const
Print information.
Ostream & printInfo(Ostream &) const
Print information.
unsigned int count() const
Count number of bits set, O(log(n))
bool found(const Key &) const
Return true if hashedEntry is found in table.
unsigned int get(const label) const
Get value at index I.
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
bool insert(const Key &key, const T &newElmt)
Insert a new hashed entry.
A dynamically allocatable list of packed unsigned integers.
Implements a timeout mechanism via sigalarm.
bool insert(const Key &key)
Insert a new entry.
dimensioned< Type > sum(const DimensionedField< Type, GeoMesh > &df)
void resize(const label, const unsigned int &val=0u)
Reset addressable list size, does not shrink the allocated size.
void shrink()
Shrink the allocated space to what is actually used.
bool found(const Key &key) const
Return true if hashed entry is found in table.