| |
|
|
| sometimes teste I with of/ one einfachen method The performance verschiedener Operationen.
I poste simply times the Resultate of my last Tests.
The number behind the Rem zeig The Number of Durchgänge within 3 sec, means so higher so faster.
The Tests show really what probably eh famous is: So less Lines, so faster. add could I: the einzeilige if counts hierbei as an eigenständige row, The function ABS against is faster. sure lying the too on it that the einzeilige if More To do has - what but too means that the einzeilige if not suitable is around the performance To raise. CompileMarkSeparation {$cleq}
float ball.xs,ball.ys,ball.rs
cls
long tme=gettickcount+3000,c
while gettickcount<tme{
c++
perfProc()
}
print c
waitinput
end
perfProc{
ball.xs=rnd(40)-20
ball.ys=rnd(40)-20
ball.rs=rnd(40)-20
/* 34500
case ball.xs>10 : ball.xs=10
case ball.xs<-10 : ball.xs=-10
case ball.rs>10 : ball.rs=10
case ball.rs<-10 : ball.rs=-10
case ball.ys<-10 : ball.ys=-10
case ball.ys>10 : ball.ys=10
*/
/* 41000
case abs(ball.xs)>10 : ball.xs=if(ball.xs<0,-10,10)
case abs(ball.ys)>10 : ball.ys=if(ball.ys<0,-10,10)
case abs(ball.ys)>10 : ball.ys=if(ball.ys<0,-10,10)
*/
/* 24000
ball.xs=if(ball.xs<-10,-10,if(ball.xs>10,10,ball.xs))
ball.ys=if(ball.ys<-10,-10,if(ball.ys>10,10,ball.ys))
ball.rs=if(ball.rs<-10,-10,if(ball.rs>10,10,ball.rs))
*/
/*
if abs(ball.xs)>10 {
if ball.xs<0 {
ball.xs=-10
} else {
ball.xs=10
}
}
if abs(ball.ys)>10 {
if ball.ys<0 {
ball.ys=-10
} else {
ball.ys=10
}
}
if abs(ball.rs)>10 {
if ball.rs<0 {
ball.rs=-10
} else {
ball.rs=10
}
} /span>
*/
}
|
|
|
| |
|
|