80 lines
1.9 KiB
C++
80 lines
1.9 KiB
C++
/*
|
|
PIP - Platform Independent Primitives
|
|
Test program
|
|
Copyright (C) 2013 Ivan Pelipenko peri4ko@gmail.com
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
//#define PIP_DEBUG
|
|
/*#include "pip.h"
|
|
|
|
|
|
class ElementA: public PIObject {
|
|
PIOBJECT(ElementA)
|
|
// ...
|
|
};
|
|
ADD_NEW_TO_COLLECTION(ab_group, ElementA)
|
|
|
|
class ElementB: public PIObject {
|
|
PIOBJECT(ElementB)
|
|
// ...
|
|
};
|
|
ADD_NEW_TO_COLLECTION(ab_group, ElementB)
|
|
|
|
class ElementC: public PIObject {
|
|
PIOBJECT(ElementC)
|
|
// ...
|
|
};
|
|
ADD_NEW_TO_COLLECTION(c_group, ElementC)
|
|
|
|
class ElementD: public PIObject {
|
|
PIOBJECT(ElementD)
|
|
// ...
|
|
};
|
|
*/
|
|
#include "pip.h"
|
|
#include <QVector>
|
|
|
|
int main (int argc, char * argv[]) {
|
|
PITimer tm;
|
|
std::vector<int> sv;
|
|
PIVector<int> pv;
|
|
QVector<int> qv;
|
|
pv.reserve(256);
|
|
for (int s = 1; s <= 20; ++s) {
|
|
int cnt = s * 1000000;
|
|
piCout << "********";
|
|
piCout << cnt << "insertion:";
|
|
sv.clear();
|
|
pv.clear();
|
|
qv.clear();
|
|
tm.reset();
|
|
for (int i = 0; i < cnt; ++i) {
|
|
sv.push_back(i);
|
|
}
|
|
piCout << "stl:" << tm.elapsed_m();
|
|
tm.reset();
|
|
for (int i = 0; i < cnt; ++i) {
|
|
pv.push_back(i);
|
|
}
|
|
piCout << "pip:" << tm.elapsed_m();
|
|
tm.reset();
|
|
for (int i = 0; i < cnt; ++i) {
|
|
qv.append(i);
|
|
}
|
|
piCout << " qt:" << tm.elapsed_m();
|
|
}
|
|
return 0;
|
|
};
|