This is PSBench.m in view mode; [Download] [Up]
#import "PSBench.h" #import "Timer.h" #define SIZE 128.0 #define TIMES 5 @implementation PSBench -setupBenchmark { [window orderFront:nil]; return self; } -benchmark { float i,j; int k; NXSize aSize = { SIZE, SIZE}; int gstate = [window gState]; id image = [[NXImage alloc] initSize:&aSize]; NXPoint cPoint = {200,200}; [image lockFocus]; PSmoveto(5.0,5.0); [[Font newFont:"Times-Roman" size:14.0 matrix: NX_IDENTITYMATRIX] set]; NXSetColor(NX_COLORBLUE); PSshow("NeXTSTEP"); [image unlockFocus]; [[window contentView] lockFocus]; [image composite:NX_COPY toPoint:&cPoint]; // promote the window [timer stopTimer]; t0 = [timer psTime]; [timer startTimer]; for(k=0;k<TIMES;k++){ for(j=400-SIZE;j>0;j-=10){ for(i=400-SIZE;i>0;i-=11){ PScomposite(0.0,0.0,SIZE,SIZE,gstate,i,j,NX_COPY); } } } [timer stopTimer]; t1 = [timer psTime]; [timer startTimer]; for(k=0;k<TIMES;k++){ for(j=400-SIZE;j>0;j-=10){ for(i=400-SIZE;i>0;i-=11){ NXPoint aPoint = {i,j}; [image composite:NX_COPY toPoint:&aPoint]; } } } [timer stopTimer]; t2 = [timer psTime]; [[window contentView] unlockFocus]; return self; } - shutdownBenchmark { char buf[256]; [window orderOut:nil]; [vvCell setDoubleValue:t1-t0]; [dvCell setDoubleValue:t2-t1]; sprintf(buf,"PostScript speed: D-V: %g V-V: %g",t1-t0,t2-t1); [self logResults:buf]; return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.