81 lines
1.4 KiB
C++
81 lines
1.4 KiB
C++
#include "pip.h"
|
|
|
|
struct A {
|
|
double x1;
|
|
//PIString str;
|
|
};
|
|
//inline PIByteArray & operator <<(PIByteArray & s, const A & a) {s << a.x1/* << a.x2*/; return s;}
|
|
//inline PIByteArray & operator >>(PIByteArray & s, A & a) {s >> a.x1/* >> a.x2*/; return s;}
|
|
|
|
struct B {
|
|
B() {
|
|
x1=0;
|
|
}
|
|
B(const B & b) = default;
|
|
//B & operator =(const B & b) {x1=b.x1; return *this;}
|
|
//A aa;
|
|
double x1;
|
|
};
|
|
//__PIVECTOR_SIMPLE_TYPE__(B)
|
|
|
|
#include "piconditionvar.h"
|
|
int main() {
|
|
PIByteArray ba; ba.reserve(100*100*16);
|
|
|
|
PITimeMeasurer tm;
|
|
PIVector2D<double> vx;
|
|
PIVector2D<double> vd;
|
|
ba << vx;
|
|
ba >> vx;
|
|
vd.resize(100, 100);
|
|
vx = vd;
|
|
tm.reset();
|
|
for(int i=0; i<1000; ++i) {
|
|
vx.clear();
|
|
vx = vd;
|
|
ba << vx;
|
|
ba >> vd;
|
|
}
|
|
piCout << tm.elapsed_m();
|
|
|
|
PIVector2D<A> ax;
|
|
PIVector2D<A> ad;
|
|
ad.resize(100, 100);
|
|
ax = ad;
|
|
tm.reset();
|
|
for(int i=0; i<1000; ++i) {
|
|
ax.clear();
|
|
ax = ad;
|
|
ba << ax;
|
|
ba >> ad;
|
|
}
|
|
piCout << tm.elapsed_m();
|
|
|
|
PIVector2D<B> bx;
|
|
PIVector2D<B> bd;
|
|
bd.resize(100, 100);
|
|
bx = bd;
|
|
tm.reset();
|
|
for(int i=0; i<1000; ++i) {
|
|
bx.clear();
|
|
bx = bd;
|
|
ba << bx;
|
|
ba >> bd;
|
|
}
|
|
piCout << tm.elapsed_m();
|
|
|
|
PIVector2D<complexd> cx;
|
|
PIVector2D<complexd> cd;
|
|
cd.resize(100, 100);
|
|
cx = cd;
|
|
tm.reset();
|
|
for(int i=0; i<1000; ++i) {
|
|
cx.clear();
|
|
cx = cd;
|
|
ba << cx;
|
|
ba >> cd;
|
|
}
|
|
piCout << tm.elapsed_m();
|
|
return 0;
|
|
}
|