the fastest way to get the length of a zero terminated string in DOS, though its not win32 it can still be used in win32 as a macro or proceedure bypassing the api altogether (by the time those push and pops are done this code has already begin scanning the string for zero terminator):
lea edi,address ; address of string
mov ecx,-1 ; maximum string length = 0xFFFFFFFF
xor eax,eax ; search for zero terminator
repnz scasb ; find first zero terminator byte
not ecx ; ecx was counting down so ecx inverted is string length
and the same thing for normal strings
lea edi,address ; address of string
mov ecx,-1 ; maximum string length = 0xFFFFFFFF
mov ax,"$" ; search for string terminator
repne scasb ; find first string terminator byte
not ecx ; ecx was counting down so ecx inverted is string length