Can I have some timings, please?
Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz
Opening \Masm32\include\Windows.inc
1003 µs for loading 26902 lines into a string array
now searching the string array for STRUCT
1543 µs for finding 1074 matches, old MB Instr
1589 µs for finding 1074 matches, old MB Instr
1577 µs for finding 1074 matches, old MB Instr
1638 µs for finding 1074 matches, old MB Instr
1601 µs for finding 1074 matches, old MB Instr
1005 µs for finding 1074 matches, new MB Instr
1003 µs for finding 1074 matches, new MB Instr
1009 µs for finding 1074 matches, new MB Instr
1008 µs for finding 1074 matches, new MB Instr
992 µs for finding 1074 matches, new MB Instr
2312 µs for finding 1074 matches, Crt strstr
2151 µs for finding 1074 matches, Crt strstr
2251 µs for finding 1074 matches, Crt strstr
2319 µs for finding 1074 matches, Crt strstr
2346 µs for finding 1074 matches, Crt strstr
2090 µs for finding 1074 matches, Masm32 find$
2092 µs for finding 1074 matches, Masm32 find$
2117 µs for finding 1074 matches, Masm32 find$
2099 µs for finding 1074 matches, Masm32 find$
2085 µs for finding 1074 matches, Masm32 find$
P.S. Masm32 find$() returned "wrong" results until I realised that eax must be positive for a match. So the correct use is this:
.if sdword ptr find$(1, pSource$, pFind$)>0
inc esi
.endif
Intel(R) Core(TM) i7 CPU 870 @ 2.93GHz
Opening \Masm32\include\Windows.inc
8409 µs for loading 26902 lines into a string array
now searching the string array for STRUCT
1403 µs for finding 1074 matches, old MB Instr
1388 µs for finding 1074 matches, old MB Instr
1392 µs for finding 1074 matches, old MB Instr
1391 µs for finding 1074 matches, old MB Instr
1396 µs for finding 1074 matches, old MB Instr
954 µs for finding 1074 matches, new MB Instr
895 µs for finding 1074 matches, new MB Instr
897 µs for finding 1074 matches, new MB Instr
899 µs for finding 1074 matches, new MB Instr
895 µs for finding 1074 matches, new MB Instr
1328 µs for finding 1074 matches, Crt strstr
1360 µs for finding 1074 matches, Crt strstr
1313 µs for finding 1074 matches, Crt strstr
1302 µs for finding 1074 matches, Crt strstr
1303 µs for finding 1074 matches, Crt strstr
1788 µs for finding 1074 matches, Masm32 find$
1945 µs for finding 1074 matches, Masm32 find$
1841 µs for finding 1074 matches, Masm32 find$
1841 µs for finding 1074 matches, Masm32 find$
1852 µs for finding 1074 matches, Masm32 find$
1301 bytes for xxOld
1320 bytes for xxNew
Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz
Opening \Masm32\include\Windows.inc
1500 µs for loading 26902 lines into a string array
now searching the string array for STRUCT
1090 µs for finding 1074 matches, old MB Instr
1599 µs for finding 1074 matches, old MB Instr
1117 µs for finding 1074 matches, old MB Instr
1087 µs for finding 1074 matches, old MB Instr
1064 µs for finding 1074 matches, old MB Instr
719 µs for finding 1074 matches, new MB Instr
713 µs for finding 1074 matches, new MB Instr
778 µs for finding 1074 matches, new MB Instr
801 µs for finding 1074 matches, new MB Instr
721 µs for finding 1074 matches, new MB Instr
1082 µs for finding 1074 matches, Crt strstr
2469 µs for finding 1074 matches, Crt strstr
1099 µs for finding 1074 matches, Crt strstr
1082 µs for finding 1074 matches, Crt strstr
1103 µs for finding 1074 matches, Crt strstr
1532 µs for finding 1074 matches, Masm32 find$
1710 µs for finding 1074 matches, Masm32 find$
1607 µs for finding 1074 matches, Masm32 find$
1616 µs for finding 1074 matches, Masm32 find$
1613 µs for finding 1074 matches, Masm32 find$
1301 bytes for xxOld
1320 bytes for xxNew
AMD Athlon(tm) II X2 220 Processor 2.8 GHz
Opening \Masm32\include\Windows.inc
2049 µs for loading 26902 lines into a string array
now searching the string array for STRUCT
2113 µs for finding 1074 matches, old MB Instr
2092 µs for finding 1074 matches, old MB Instr
2083 µs for finding 1074 matches, old MB Instr
2199 µs for finding 1074 matches, old MB Instr
2096 µs for finding 1074 matches, old MB Instr
1160 µs for finding 1074 matches, new MB Instr
1260 µs for finding 1074 matches, new MB Instr
1154 µs for finding 1074 matches, new MB Instr
1162 µs for finding 1074 matches, new MB Instr
1158 µs for finding 1074 matches, new MB Instr
2331 µs for finding 1074 matches, Crt strstr
2370 µs for finding 1074 matches, Crt strstr
2293 µs for finding 1074 matches, Crt strstr
2398 µs for finding 1074 matches, Crt strstr
2297 µs for finding 1074 matches, Crt strstr
2623 µs for finding 1074 matches, Masm32 find$
2695 µs for finding 1074 matches, Masm32 find$
2791 µs for finding 1074 matches, Masm32 find$
2767 µs for finding 1074 matches, Masm32 find$
2730 µs for finding 1074 matches, Masm32 find$
1301 bytes for xxOld
1320 bytes for xxNew
Intel(R) Core(TM) i7-4930K CPU @ 3.40GHz
Opening \Masm32\include\Windows.inc
1589 µs for loading 30994 lines into a string array
now searching the string array for STRUCT
1568 µs for finding 1055 matches, old MB Instr
4373 µs for finding 1055 matches, old MB Instr
4272 µs for finding 1055 matches, old MB Instr
2829 µs for finding 1055 matches, old MB Instr
3181 µs for finding 1055 matches, old MB Instr
1014 µs for finding 1055 matches, new MB Instr
2752 µs for finding 1055 matches, new MB Instr
2776 µs for finding 1055 matches, new MB Instr
2779 µs for finding 1055 matches, new MB Instr
2746 µs for finding 1055 matches, new MB Instr
1465 µs for finding 1055 matches, Crt strstr
1468 µs for finding 1055 matches, Crt strstr
1457 µs for finding 1055 matches, Crt strstr
1472 µs for finding 1055 matches, Crt strstr
1481 µs for finding 1055 matches, Crt strstr
2107 µs for finding 1055 matches, Masm32 find$
2140 µs for finding 1055 matches, Masm32 find$
2151 µs for finding 1055 matches, Masm32 find$
2112 µs for finding 1055 matches, Masm32 find$
2122 µs for finding 1055 matches, Masm32 find$
1301 bytes for xxOld
1320 bytes for xxNew
Thanks to everybody - the new faster version is online. Below one more result with the old macro:
Microsoft Windows [Versione 10.0.17134.472]
(c) 2018 Microsoft Corporation. Tutti i diritti sono riservati.
C:\Masm32\MasmBasic>InstrFast4Arrays.exe
Intel(R) Celeron(R) CPU N2840 @ 2.16GHz
Opening \Masm32\include\Windows.inc
3260 µs for loading 26902 lines into a string array
now searching the string array for STRUCT
3403 µs for finding 1074 matches, old MB Instr
3568 µs for finding 1074 matches, old MB Instr
3329 µs for finding 1074 matches, old MB Instr
3888 µs for finding 1074 matches, old MB Instr
3356 µs for finding 1074 matches, old MB Instr
2355 µs for finding 1074 matches, new MB Instr
1961 µs for finding 1074 matches, new MB Instr
2002 µs for finding 1074 matches, new MB Instr
2003 µs for finding 1074 matches, new MB Instr
2116 µs for finding 1074 matches, new MB Instr
2558 µs for finding 1074 matches, Crt strstr
2691 µs for finding 1074 matches, Crt strstr
5732 µs for finding 1074 matches, Crt strstr
2521 µs for finding 1074 matches, Crt strstr
2743 µs for finding 1074 matches, Crt strstr
3722 µs for finding 1074 matches, Masm32 find$
4190 µs for finding 1074 matches, Masm32 find$
4108 µs for finding 1074 matches, Masm32 find$
4154 µs for finding 1074 matches, Masm32 find$
4077 µs for finding 1074 matches, Masm32 find$
Intel(R) Core(TM) i7-4810MQ CPU @ 2.80GHz
Opening \Masm32\include\Windows.inc
1525 µs for loading 26902 lines into a string array
now searching the string array for STRUCT
1203 µs for finding 1074 matches, old MB Instr
2024 µs for finding 1074 matches, old MB Instr
1303 µs for finding 1074 matches, old MB Instr
1115 µs for finding 1074 matches, old MB Instr
1056 µs for finding 1074 matches, old MB Instr
714 µs for finding 1074 matches, new MB Instr
725 µs for finding 1074 matches, new MB Instr
769 µs for finding 1074 matches, new MB Instr
728 µs for finding 1074 matches, new MB Instr
726 µs for finding 1074 matches, new MB Instr
1067 µs for finding 1074 matches, Crt strstr
1189 µs for finding 1074 matches, Crt strstr
1164 µs for finding 1074 matches, Crt strstr
1136 µs for finding 1074 matches, Crt strstr
1077 µs for finding 1074 matches, Crt strstr
1530 µs for finding 1074 matches, Masm32 find$
1559 µs for finding 1074 matches, Masm32 find$
1887 µs for finding 1074 matches, Masm32 find$
1545 µs for finding 1074 matches, Masm32 find$
1523 µs for finding 1074 matches, Masm32 find$
1301 bytes for xxOld
1320 bytes for xxNew