git-svn-id: svn://db.shs.com.ru/pip@849 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
26
main.cpp
26
main.cpp
@@ -331,35 +331,37 @@ int main() {
|
|||||||
//h.reserve(64);
|
//h.reserve(64);
|
||||||
//piCout << h.keys() << h.values();
|
//piCout << h.keys() << h.values();
|
||||||
//piCout << (1 << 2);
|
//piCout << (1 << 2);
|
||||||
PIHash<PIString, PIString> h2;
|
PIHash<int, PIString> h2;
|
||||||
PIMap<PIString, PIString> m2;
|
PIMap<int, PIString> m2;
|
||||||
PIString prefix = "1234567890";
|
PIVector<int> keys;
|
||||||
|
PIString prefix = "1234567890fgbjyfjyjbghjkbgkbgjgsfh jhfgj ghfjhjfjf";
|
||||||
PITimeMeasurer tm;
|
PITimeMeasurer tm;
|
||||||
double el = 0.;
|
double el = 0.;
|
||||||
|
for (int i=0; i<100000; ++i) keys << randomi();
|
||||||
|
piCout << keys.size();
|
||||||
tm.reset();
|
tm.reset();
|
||||||
for (int i=0; i<10000; ++i) {
|
for (int i=0; i<100000; ++i) {
|
||||||
h2[prefix + PIString::fromNumber(i)+"1234567890"] = PIString::fromNumber(randomi());
|
h2[keys[i]] = prefix;
|
||||||
}
|
}
|
||||||
el = tm.elapsed_m(); piCout << el << h2.capacity();
|
el = tm.elapsed_m(); piCout << el << h2.capacity();
|
||||||
|
|
||||||
tm.reset();
|
tm.reset();
|
||||||
for (int i=0; i<10000; ++i) {
|
for (int i=0; i<100000; ++i) {
|
||||||
m2[prefix + PIString::fromNumber(i)+"1234567890"] = PIString::fromNumber(randomi());
|
m2[keys[i]] = prefix;
|
||||||
}
|
}
|
||||||
el = tm.elapsed_m(); piCout << el;
|
el = tm.elapsed_m(); piCout << el;
|
||||||
piCout << "*********";
|
piCout << "*********";
|
||||||
|
|
||||||
PIString _s;
|
PIString _s;
|
||||||
tm.reset();
|
tm.reset();
|
||||||
for (int i=0; i<10000; ++i) {
|
for (int i=0; i<100000; ++i) {
|
||||||
_s = h2.value(prefix + PIString::fromNumber(i)+"1234567890");
|
_s = h2.value(keys[i]);
|
||||||
}
|
}
|
||||||
el = tm.elapsed_m(); piCout << el << h2.capacity();
|
el = tm.elapsed_m(); piCout << el << h2.capacity();
|
||||||
|
|
||||||
tm.reset();
|
tm.reset();
|
||||||
for (int i=0; i<10000; ++i) {
|
for (int i=0; i<100000; ++i) {
|
||||||
_s = m2.value(prefix + PIString::fromNumber(i)+"1234567890");
|
_s = m2.value(keys[i]);
|
||||||
}
|
}
|
||||||
el = tm.elapsed_m(); piCout << el;
|
el = tm.elapsed_m(); piCout << el;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user