Testbug's speed tests

Comparing Win32 APIs

Drawing text

These tests are intended to compare the speed of the various text output APIs, ExtTextOut, TextOut, TabbedTextOut, PolyTextOut, DrawText and DrawTextEx. In fact they were found to be remarkably similar in speed.
Each test is done 1000 times and each actually does write to an enlargement of the dialog. The string used is "Quick brown fox jumps over the lazy dog" which is 39 characters long including the null terminator.

Here is the coding of the ExtTextOut API which is self explanatory:-

PUSH 0
PUSH 39                 ;number of characters in string
PUSH ESI                ;address of string
PUSH 0,0
PUSH [Y_PLACE]          ;y coord
PUSH 50                 ;x coord
PUSH [hDC]
CALL ExtTextOutA
OR EAX,EAX              ;see if false finish
Here is the coding of the TextOut API:-
PUSH 39                 ;number of characters in string
PUSH ESI                ;address of string
PUSH [Y_PLACE]          ;y coord
PUSH 50                 ;x coord
PUSH [hDC]
CALL TextOutA           ;write characters to screen
OR EAX,EAX              ;see if false finish
Here is the coding of the TabbedTextOut API:-
PUSH 0,0,0
PUSH 39                 ;number of characters in string
PUSH ESI                ;address of string
PUSH [Y_PLACE]          ;y coord
PUSH 50                 ;x coord
PUSH [hDC]
CALL TabbedTextOutA     ;write characters to screen
OR EAX,EAX              ;see if false finish
Here is the coding for PolyTextOut (having set up the x and y coordinates, number of characters in and address of string in the POLYTEXT structure):-
PUSH 1                  ;1 structure in array
PUSH ADDR POLYTEXT
PUSH [hDC]
CALL PolyTextOutA       ;write characters to screen
OR EAX,EAX              ;see if false finish
Here is the coding for DrawText (having set up the rectangle in the RECT structure):-
PUSH 0
PUSH ADDR RECT          ;place to write
PUSH 39                 ;number of characters in string
PUSH ESI                ;correct string to write
PUSH [hDC]              ;handle of device context
CALL DrawTextA          ;write characters to screen
OR EAX,EAX              ;see if false finish
And finally the DrawTextEx API (having set up the rectangle in the RECT structure):-
PUSH 0,0
PUSH ADDR RECT          ;place to write
PUSH 39                 ;number of characters in string
PUSH ESI                ;correct string to write
PUSH [hDC]              ;handle of device context
CALL DrawTextExA        ;write characters to screen
OR EAX,EAX              ;see if false finish