' imgputt() and PutEx() benchmark ' ' Usage : imgputt_test2.exe [BPP] ' BPP : 8, 16, 32 ' ' Last updated: <2024/02/07 05:54:53 +0900> '#include "imgputt.bi" #include "imgputt_new.bi" #include "putex.bi" Dim As Integer bpp = 32 ' check command line option Select Case Command(1) Case "32" : bpp = 32 Case "16" : bpp = 16 Case "8" : bpp = 8 Case "/?", "-h", "--help" Print "Usage : " & Command(0) & " [BPP]" Print " BPP : 8, 16, 32" : end End Select screenres 512, 288, bpp Dim As Any Ptr p = ImageCreate(101, 101) Select Case bpp Case 32 : Bload "sprite_24bit.bmp", p Case 16 : Bload "sprite_16bit.bmp", p Case 8 : Bload "sprite_8bit.bmp", p : color 14, 15 : cls End Select Dim As Double starttime, t0, t1, t2 Dim As Integer max_count = 5000 Sub sub1(ByVal max_count As Integer, ByVal p As Any Ptr) For i As Integer = 0 To max_count Put (10, 10), p, Trans ' Put (10, 10), p, Pset Next i End Sub Sub sub2(ByVal max_count As Integer, ByVal p As Any Ptr) For i As Integer = 0 To max_count imgputt( p, , 130, 10, TRANSFORM_HFLIP, 0 ) 'imgputt( p, , 130, 10, TRANSFORM_VFLIP, 0 ) 'imgputt( p, , 130, 10, TRANSFORM_HFLIP Or TRANSFORM_VFLIP, 0 ) Next i End Sub Sub sub3(ByVal max_count As Integer, ByVal p As Any Ptr) For i As Integer = 0 To max_count PutEx(10, 130, p, 0, 0, 101, 101, 1) 'PutEx(10, 130, p, 0, 0, 101, 101, 2) 'PutEx(10, 130, p, 0, 0, 101, 101, 3) Next i End Sub starttime = Timer ScreenLock sub1(max_count, p) ScreenUnlock t0 = Timer - starttime sleep 1000 starttime = Timer ScreenLock sub2(max_count, p) ScreenUnlock t1 = Timer - starttime sleep 1000 starttime = Timer ScreenLock sub3(max_count, p) ScreenUnlock t2 = Timer - starttime sleep 1000 Print "Put : " & t0 & " sec (100%)" Print "imgputt : " & t1 & " sec (" & int((t1 / t0) * 100) & "%)" Print "PutEx : " & t2 & " sec (" & int((t2 / t0) * 100) & "%)" imagedestroy p sleep