Testing machine:
win7
8G
I7 2600
qt4.7.4 php5.3.8 python 2.6
run with qt
t.start();
for(int i=0;i<=1000000;i++){
aa += "1";
}
printf("used: %d ms", t.elapsed());
QTime t;
t.start();
QString aa="";
for(int i=0;i<=1000000;i++){
aa += "1";
}
printf("used: %d ms", t.elapsed());
To copy to clipboard, switch view to plain text mode
debug :240ms
release:138ms
run with php
$time = new runtime;
$time->start();
$str = "";
for ($i = 0; $i <= 1000000; $i++) {
$str.="1";
}
$time->stop();
echo "used:" . $time->spent() . "ms";
$time = new runtime;
$time->start();
$str = "";
for ($i = 0; $i <= 1000000; $i++) {
$str.="1";
}
$time->stop();
echo "used:" . $time->spent() . "ms";
To copy to clipboard, switch view to plain text mode
used time :92.9ms
run with python:
import os,sys
from time import clock as now
start = now()
str = ""
for i in range(0,1000000):
str += "i"
finish = now()
print (finish-start)
import os,sys
from time import clock as now
start = now()
str = ""
for i in range(0,1000000):
str += "i"
finish = now()
print (finish-start)
To copy to clipboard, switch view to plain text mode
used time:210ms
run with qt c++:
t.start();
char *pStr = new char[1000001];
for(int i=0;i<=1000000;i++){
pStr[i] = '1';
}
delete pStr;
printf("used: %d ms",t.elapsed());
QTime t;
t.start();
char *pStr = new char[1000001];
for(int i=0;i<=1000000;i++){
pStr[i] = '1';
}
delete pStr;
printf("used: %d ms",t.elapsed());
To copy to clipboard, switch view to plain text mode
debug,3ms
release,1ms
not just this one test,every test just faster to python,there is no php half of the fast
is this my qt configuration's problem?
some one answer me,please
Bookmarks