News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

What is the most effective way

Started by zemtex, December 20, 2010, 05:08:11 PM

Previous topic - Next topic

jj2007

Interesting that a CRT algo understands German umlauts when set to "English" :wink

Intel(R) Celeron(R) M CPU        420  @ 1.60GHz (SSE3)
24 bytes
47 cycles, MasmBasic
135 cycles, szCmpi
111 cycles, Cmpi
1063 cycles, crt__stricmp

93 bytes
93 cycles, MasmBasic
535 cycles, szCmpi
405 cycles, Cmpi
4040 cycles, crt__stricmp

185 bytes
144 cycles, MasmBasic
993 cycles, szCmpi
767 cycles, Cmpi
8010 cycles, crt__stricmp

Correctness:

sLow db "thüs is ä töst with èéìàù", 0
sUpp db "THÜS IS Ä TÖST WITH ÈÉÌÀÙ", 0

equal for MasmBasic
non-equal for szCmpi
non-equal for Cmpi
equal for crt__stricmp


szCmpi and Cmpi suffer from the same problem - this table:
      szCmpi_tbl \
      db   0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15
      db  16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31
      db  32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47
      db  48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63
      db  64, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111
      db 112,113,114,115,116,117,118,119,120,121,122, 91, 92, 93, 94, 95
      db  96, 97, 98, 99,100,101,102,103,104,105,106,107,108,109,110,111
      db 112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127
      db 128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143
      db 144,145,146,147,148,149,150,151,152,153,154,155,156,156,158,159
      db 160,161,162,163,164,165,166,167,168,169,170,171,172,173,173,175
      db 176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191
      db 192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207
      db 208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,223
      db 224,225,226,227,228,229,230,231,232,233,234,235,236,237,238,239
      db 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255

hutch--

> szCmpi and Cmpi suffer from the same problem

They use a user specified replacement table so the user CAN specify the replacement table.  :bg
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

jj2007

Well, I must have missed that part of the Cmpi documentation :bg

Anyway, it could be done with a generated table that behaves as it should:

Intel(R) Celeron(R) M CPU        420  @ 1.60GHz (SSE3)
24 bytes
46 cycles, MasmBasic
77 cycles, CmpiJJ
168 cycles, szCmpi
112 cycles, Cmpi
1067 cycles, crt__stricmp

93 bytes
93 cycles, MasmBasic
299 cycles, CmpiJJ
531 cycles, szCmpi
404 cycles, Cmpi
4026 cycles, crt__stricmp

185 bytes
144 cycles, MasmBasic
576 cycles, CmpiJJ
978 cycles, szCmpi
769 cycles, Cmpi
7983 cycles, crt__stricmp

Correctness (expected: equal):
equal for MasmBasic
equal for CmpiJJ
non-equal for szCmpi
non-equal for Cmpi
equal for crt__stricmp

Code size:
310      bytes for Cmpi
152      bytes for CmpiJJ


Half as long, correct results, and a bit faster. And it's not even SSE2...  :wink

jj2007

That algo of mine was eccessively bloated, apologies. Here is a version that takes 8 paras (8*16=128 bytes).
Timings exactly as before.