|
|
Please don't answer with "nothing new. I use it so long". I use it so long, too.
I just want to make benchmark and result is some kind of tips&trick thing.
I want to compare speed between macro calculation, inline calculation and
function calculation. All tests are performed with currrent (10) beta of POV-Ray
3.5 for Windows (icl) on PII 233 with 128 MB and. Here are scripts:
// SCRIPT 1 - Macro calculation
#macro Calc(X,Y)sin(X)+Y+cos(X*Y)^2+1/3#end
#local MaxX=500;
#local MaxY=500;
#local X=0;
#while(X<MaxX)
#local Y=0;
#while(Y<MaxY)
#local D=Calc(X,Y);
#local Y=Y+1;
#end
#local X=X+1;
#end
// SCRIPT 2 - inline calculation
#local MaxX=500;
#local MaxY=500;
#local X=0;
#while(X<MaxX)
#local Y=0;
#while(Y<MaxY)
#local D=sin(X)+Y+cos(X*Y)^2+1/3;
#local Y=Y+1;
#end
#local X=X+1;
#end
// SCRIPT 3 - function calculations
#local Calc=function(X,Y){sin(X)+Y+cos(X*Y)^2+1/3};
#local MaxX=500;
#local MaxY=500;
#local X=0;
#while(X<MaxX)
#local Y=0;
#while(Y<MaxY)
#local D=Calc(X,Y);
#local Y=Y+1;
#end
#local X=X+1;
#end
// RESULTS
// SCRIPT 1 - macro calculations
CPU time used: kernel 20.79 seconds, user 74.22 seconds, total 95.01 seconds
// SCRIPT 2 - inline calculations
CPU time used: kernel 9.74 seconds, user 47.34 seconds, total 57.08 seconds
// SCRIPT 3 - function calculations
CPU time used: kernel 8.95 seconds, user 37.78 seconds, total 46.74 seconds
ABX
Post a reply to this message
|
|