Author Topic: Instr() timings  (Read 14936 times)

jj2007

  • Member
  • *****
  • Posts: 13651
  • Assembly is fun ;-)
    • MasmBasic
Instr() timings
« on: September 22, 2015, 10:42:12 AM »
Just for fun... :P

Work in progress, don't use for anything serious! And note how competitive the CRT strstr() algo is, at least for one byte patterns :biggrin:

It needs a 4MB text file, which gets automatically downloaded if it's not in the exe's folder.

Code: [Select]
33979 lines found
Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz (MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX)
680 ms  for finding 996156 lines containing J using CRT strstr()
1126 ms for finding 996156 lines containing J using MB Instr_()
1084 ms for finding 996156 lines containing J using faster Instr_()

1226 ms for finding 209040 lines containing Jes using CRT strstr()
1028 ms for finding 209040 lines containing Jes using MB Instr_()
372 ms  for finding 209040 lines containing Jes using faster Instr_()

1221 ms for finding 188940 lines containing Jesus using CRT strstr()
1025 ms for finding 188940 lines containing Jesus using MB Instr_()
378 ms  for finding 188940 lines containing Jesus using faster Instr_()

1255 ms for finding 38592 lines containing Jesus C using CRT strstr()
1040 ms for finding 38592 lines containing Jesus C using MB Instr_()
377 ms  for finding 38592 lines containing Jesus C using faster Instr_()

1238 ms for finding 38592 lines containing Jesus Chr using CRT strstr()
1036 ms for finding 38592 lines containing Jesus Chr using MB Instr_()
389 ms  for finding 38592 lines containing Jesus Chr using faster Instr_()

1251 ms for finding 38592 lines containing Jesus Chris using CRT strstr()
1032 ms for finding 38592 lines containing Jesus Chris using MB Instr_()
377 ms  for finding 38592 lines containing Jesus Chris using faster Instr_()

1248 ms for finding 38592 lines containing Jesus Christ using CRT strstr()
1047 ms for finding 38592 lines containing Jesus Christ using MB Instr_()
385 ms  for finding 38592 lines containing Jesus Christ using faster Instr_()

One more:
Code: [Select]
Intel(R) Celeron(R) CPU  N2840  @ 2.16GHz (MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1,
SSE4.2)
1042 ms for finding 996156 lines containing J using CRT strstr()
1615 ms for finding 996156 lines containing J using MB Instr_()
1552 ms for finding 996156 lines containing J using faster Instr_()

1451 ms for finding 209040 lines containing Jes using CRT strstr()
1810 ms for finding 209040 lines containing Jes using MB Instr_()
633 ms  for finding 209040 lines containing Jes using faster Instr_()

1436 ms for finding 188940 lines containing Jesus using CRT strstr()
1809 ms for finding 188940 lines containing Jesus using MB Instr_()
634 ms  for finding 188940 lines containing Jesus using faster Instr_()

1454 ms for finding 38592 lines containing Jesus C using CRT strstr()
1835 ms for finding 38592 lines containing Jesus C using MB Instr_()
629 ms  for finding 38592 lines containing Jesus C using faster Instr_()

1469 ms for finding 38592 lines containing Jesus Chr using CRT strstr()
1837 ms for finding 38592 lines containing Jesus Chr using MB Instr_()
630 ms  for finding 38592 lines containing Jesus Chr using faster Instr_()

1451 ms for finding 38592 lines containing Jesus Chris using CRT strstr()
1836 ms for finding 38592 lines containing Jesus Chris using MB Instr_()
632 ms  for finding 38592 lines containing Jesus Chris using faster Instr_()

1456 ms for finding 38592 lines containing Jesus Christ using CRT strstr()
1838 ms for finding 38592 lines containing Jesus Christ using MB Instr_()
660 ms  for finding 38592 lines containing Jesus Christ using faster Instr_()

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: Instr() timings
« Reply #1 on: September 22, 2015, 12:50:22 PM »
holy shit !!!  :lol:

Code: [Select]
Bible.txt downloaded
33979 lines found
Intel(R) Pentium(R) 4 CPU 3.00GHz (MMX, SSE, SSE2, SSE3)
1159 ms for finding 996156 lines containing J using CRT strstr()
2046 ms for finding 996156 lines containing J using MB Instr_()
1997 ms for finding 996156 lines containing J using faster Instr_()

1621 ms for finding 209040 lines containing Jes using CRT strstr()
1819 ms for finding 209040 lines containing Jes using MB Instr_()
962 ms  for finding 209040 lines containing Jes using faster Instr_()

1613 ms for finding 188940 lines containing Jesus using CRT strstr()
1816 ms for finding 188940 lines containing Jesus using MB Instr_()
1263 ms for finding 188940 lines containing Jesus using faster Instr_()

1629 ms for finding 38592 lines containing Jesus C using CRT strstr()
1846 ms for finding 38592 lines containing Jesus C using MB Instr_()
984 ms  for finding 38592 lines containing Jesus C using faster Instr_()

1648 ms for finding 38592 lines containing Jesus Chr using CRT strstr()
1849 ms for finding 38592 lines containing Jesus Chr using MB Instr_()
985 ms  for finding 38592 lines containing Jesus Chr using faster Instr_()

1646 ms for finding 38592 lines containing Jesus Chris using CRT strstr()
1850 ms for finding 38592 lines containing Jesus Chris using MB Instr_()
985 ms  for finding 38592 lines containing Jesus Chris using faster Instr_()

1667 ms for finding 38592 lines containing Jesus Christ using CRT strstr()
1855 ms for finding 38592 lines containing Jesus Christ using MB Instr_()
984 ms  for finding 38592 lines containing Jesus Christ using faster Instr_()

zedd151

  • Member
  • *****
  • Posts: 1931
Re: Instr() timings
« Reply #2 on: September 22, 2015, 01:09:20 PM »
5204 ms - InString
4807 ms - InString
4877 ms - InString

3898 ms - zStr
3788 ms - zStr
3692 ms - zStr
 done!

oops, wrong test  8)
Regards, zedd.
:tongue:

sinsi

  • Guest
Re: Instr() timings
« Reply #3 on: September 22, 2015, 01:41:02 PM »
Code: [Select]
Bible.txt downloaded
33979 lines found
Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz (MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX)
382 ms  for finding 996156 lines containing J using CRT strstr()
685 ms  for finding 996156 lines containing J using MB Instr_()
679 ms  for finding 996156 lines containing J using faster Instr_()

541 ms  for finding 209040 lines containing Jes using CRT strstr()
501 ms  for finding 209040 lines containing Jes using MB Instr_()
208 ms  for finding 209040 lines containing Jes using faster Instr_()

539 ms  for finding 188940 lines containing Jesus using CRT strstr()
509 ms  for finding 188940 lines containing Jesus using MB Instr_()
214 ms  for finding 188940 lines containing Jesus using faster Instr_()

553 ms  for finding 38592 lines containing Jesus C using CRT strstr()
516 ms  for finding 38592 lines containing Jesus C using MB Instr_()
219 ms  for finding 38592 lines containing Jesus C using faster Instr_()

550 ms  for finding 38592 lines containing Jesus Chr using CRT strstr()
507 ms  for finding 38592 lines containing Jesus Chr using MB Instr_()
214 ms  for finding 38592 lines containing Jesus Chr using faster Instr_()

552 ms  for finding 38592 lines containing Jesus Chris using CRT strstr()
519 ms  for finding 38592 lines containing Jesus Chris using MB Instr_()
217 ms  for finding 38592 lines containing Jesus Chris using faster Instr_()

546 ms  for finding 38592 lines containing Jesus Christ using CRT strstr()
508 ms  for finding 38592 lines containing Jesus Christ using MB Instr_()
219 ms  for finding 38592 lines containing Jesus Christ using faster Instr_()

rrr314159

  • Member
  • *****
  • Posts: 1378
Re: Instr() timings
« Reply #4 on: September 22, 2015, 01:48:50 PM »
Code: [Select]
33979 lines found
AMD A6-6310 APU with AMD Radeon R4 Graphics     (MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4
.2, AVX)
1156 ms for finding 996156 lines containing J using CRT strstr()
1673 ms for finding 996156 lines containing J using MB Instr_()
1596 ms for finding 996156 lines containing J using faster Instr_()

1779 ms for finding 209040 lines containing Jes using CRT strstr()
1931 ms for finding 209040 lines containing Jes using MB Instr_()
660 ms  for finding 209040 lines containing Jes using faster Instr_()

1799 ms for finding 188940 lines containing Jesus using CRT strstr()
1931 ms for finding 188940 lines containing Jesus using MB Instr_()
677 ms  for finding 188940 lines containing Jesus using faster Instr_()

1822 ms for finding 38592 lines containing Jesus C using CRT strstr()
1974 ms for finding 38592 lines containing Jesus C using MB Instr_()
700 ms  for finding 38592 lines containing Jesus C using faster Instr_()

1772 ms for finding 38592 lines containing Jesus Chr using CRT strstr()
1970 ms for finding 38592 lines containing Jesus Chr using MB Instr_()
678 ms  for finding 38592 lines containing Jesus Chr using faster Instr_()

1822 ms for finding 38592 lines containing Jesus Chris using CRT strstr()
2008 ms for finding 38592 lines containing Jesus Chris using MB Instr_()
704 ms  for finding 38592 lines containing Jesus Chris using faster Instr_()

1807 ms for finding 38592 lines containing Jesus Christ using CRT strstr()
1962 ms for finding 38592 lines containing Jesus Christ using MB Instr_()
722 ms  for finding 38592 lines containing Jesus Christ using faster Instr_()

-- hit any key --
I am NaN ;)

mabdelouahab

  • Member
  • ****
  • Posts: 518
Re: Instr() timings
« Reply #5 on: September 22, 2015, 03:19:57 PM »
Code: [Select]
Bible.txt downloaded
33979 lines found
Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz (MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, S
SE4.2, AVX)
919 ms  for finding 996156 lines containing J using CRT strstr()
1613 ms for finding 996156 lines containing J using MB Instr_()
1512 ms for finding 996156 lines containing J using faster Instr_()

1028 ms for finding 209040 lines containing Jes using CRT strstr()
1136 ms for finding 209040 lines containing Jes using MB Instr_()
476 ms  for finding 209040 lines containing Jes using faster Instr_()

1031 ms for finding 188940 lines containing Jesus using CRT strstr()
1164 ms for finding 188940 lines containing Jesus using MB Instr_()
495 ms  for finding 188940 lines containing Jesus using faster Instr_()

1025 ms for finding 38592 lines containing Jesus C using CRT strstr()
1606 ms for finding 38592 lines containing Jesus C using MB Instr_()
1646 ms for finding 38592 lines containing Jesus C using faster Instr_()

3167 ms for finding 38592 lines containing Jesus Chr using CRT strstr()
3728 ms for finding 38592 lines containing Jesus Chr using MB Instr_()
1555 ms for finding 38592 lines containing Jesus Chr using faster Instr_()

3260 ms for finding 38592 lines containing Jesus Chris using CRT strstr()
3822 ms for finding 38592 lines containing Jesus Chris using MB Instr_()
1614 ms for finding 38592 lines containing Jesus Chris using faster Instr_()

3393 ms for finding 38592 lines containing Jesus Christ using CRT strstr()
4073 ms for finding 38592 lines containing Jesus Christ using MB Instr_()
1608 ms for finding 38592 lines containing Jesus Christ using faster Instr_()

-- hit any key --

jj2007

  • Member
  • *****
  • Posts: 13651
  • Assembly is fun ;-)
    • MasmBasic
Re: Instr() timings
« Reply #6 on: September 22, 2015, 04:21:33 PM »
Code: [Select]
Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz (MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, S
SE4.2, AVX)
3393 ms for finding 38592 lines containing Jesus Christ using CRT strstr()
4073 ms for finding 38592 lines containing Jesus Christ using MB Instr_()
1608 ms for finding 38592 lines containing Jesus Christ using faster Instr_()

Code: [Select]
Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz (MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, AVX)
1248 ms for finding 38592 lines containing Jesus Christ using CRT strstr()
1047 ms for finding 38592 lines containing Jesus Christ using MB Instr_()
385 ms  for finding 38592 lines containing Jesus Christ using faster Instr_()

Really fat differences between two i5 CPUs again ::)

Thanks to everybody :icon14:

P.S.: Dave... :eusa_naughty:

I use that 4 MB text file for rather pragmatic reasons: It is difficult to find a text corpus for such tests that is large enough to go well beyond the data cache. Sometimes I concatenate it to do the tests with 400 or 800 MB, which is close to the allocation limit of Windows.

Siekmanski

  • Member
  • *****
  • Posts: 2622
Re: Instr() timings
« Reply #7 on: September 22, 2015, 05:29:44 PM »
Code: [Select]
33979 lines found
Intel(R) Core(TM) i7-4930K CPU @ 3.40GHz (MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, S
SE4.2, AVX)
467 ms  for finding 996156 lines containing J using CRT strstr()
795 ms  for finding 996156 lines containing J using MB Instr_()
784 ms  for finding 996156 lines containing J using faster Instr_()

667 ms  for finding 209040 lines containing Jes using CRT strstr()
730 ms  for finding 209040 lines containing Jes using MB Instr_()
267 ms  for finding 209040 lines containing Jes using faster Instr_()

670 ms  for finding 188940 lines containing Jesus using CRT strstr()
739 ms  for finding 188940 lines containing Jesus using MB Instr_()
278 ms  for finding 188940 lines containing Jesus using faster Instr_()

673 ms  for finding 38592 lines containing Jesus C using CRT strstr()
744 ms  for finding 38592 lines containing Jesus C using MB Instr_()
279 ms  for finding 38592 lines containing Jesus C using faster Instr_()

676 ms  for finding 38592 lines containing Jesus Chr using CRT strstr()
742 ms  for finding 38592 lines containing Jesus Chr using MB Instr_()
274 ms  for finding 38592 lines containing Jesus Chr using faster Instr_()

675 ms  for finding 38592 lines containing Jesus Chris using CRT strstr()
750 ms  for finding 38592 lines containing Jesus Chris using MB Instr_()
276 ms  for finding 38592 lines containing Jesus Chris using faster Instr_()

673 ms  for finding 38592 lines containing Jesus Christ using CRT strstr()
742 ms  for finding 38592 lines containing Jesus Christ using MB Instr_()
276 ms  for finding 38592 lines containing Jesus Christ using faster Instr_()

-- hit any key --
Creative coders use backward thinking techniques as a strategy.

TWell

  • Member
  • ****
  • Posts: 743
Re: Instr() timings
« Reply #8 on: September 22, 2015, 06:32:06 PM »
Code: [Select]
Bible.txt downloaded
33979 lines found
AMD E-450 APU with Radeon(tm) HD Graphics (MMX, SSE, SSE2, SSE3, SSSE3) 1,6 GHz
1898 ms for finding 996156 lines containing J using CRT strstr()
2593 ms for finding 996156 lines containing J using MB Instr_()
2541 ms for finding 996156 lines containing J using faster Instr_()

2449 ms for finding 209040 lines containing Jes using CRT strstr()
2851 ms for finding 209040 lines containing Jes using MB Instr_()
1124 ms for finding 209040 lines containing Jes using faster Instr_()

2473 ms for finding 188940 lines containing Jesus using CRT strstr()
2868 ms for finding 188940 lines containing Jesus using MB Instr_()
1168 ms for finding 188940 lines containing Jesus using faster Instr_()

2494 ms for finding 38592 lines containing Jesus C using CRT strstr()
2841 ms for finding 38592 lines containing Jesus C using MB Instr_()
1210 ms for finding 38592 lines containing Jesus C using faster Instr_()

2641 ms for finding 38592 lines containing Jesus Chr using CRT strstr()
2879 ms for finding 38592 lines containing Jesus Chr using MB Instr_()
1171 ms for finding 38592 lines containing Jesus Chr using faster Instr_()

2510 ms for finding 38592 lines containing Jesus Chris using CRT strstr()
2939 ms for finding 38592 lines containing Jesus Chris using MB Instr_()
1194 ms for finding 38592 lines containing Jesus Chris using faster Instr_()

2490 ms for finding 38592 lines containing Jesus Christ using CRT strstr()
2848 ms for finding 38592 lines containing Jesus Christ using MB Instr_()
1172 ms for finding 38592 lines containing Jesus Christ using faster Instr_()

-- hit any key --

jj2007

  • Member
  • *****
  • Posts: 13651
  • Assembly is fun ;-)
    • MasmBasic
Re: Instr() timings
« Reply #9 on: September 22, 2015, 10:45:16 PM »
Thanks :icon14:

New version, includes Masm32 find$() aka InString (note that find$() returns always zero if an empty pattern is passed; it also chokes with an exception if empty pattern meets end of array...):

Code: [Select]
Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz
32 ms   for finding 2004761 lines containing [] using CRT strstr()
399 ms  for finding 0 lines containing [] using Masm32 find$()
348 ms  for finding 2004761 lines containing [] using MB Instr_()
33 ms   for finding 2004761 lines containing [] using faster Instr_()

199 ms  for finding 292404 lines containing [J] using CRT strstr()
367 ms  for finding 292404 lines containing [J] using Masm32 find$()
326 ms  for finding 292404 lines containing [J] using MB Instr_()
320 ms  for finding 292404 lines containing [J] using faster Instr_()

347 ms  for finding 165908 lines containing [Je] using CRT strstr()
379 ms  for finding 165908 lines containing [Je] using Masm32 find$()
287 ms  for finding 165908 lines containing [Je] using MB Instr_()
107 ms  for finding 165908 lines containing [Je] using faster Instr_()

365 ms  for finding 61360 lines containing [Jes] using CRT strstr()
391 ms  for finding 61360 lines containing [Jes] using Masm32 find$()
299 ms  for finding 61360 lines containing [Jes] using MB Instr_()
112 ms  for finding 61360 lines containing [Jes] using faster Instr_()

363 ms  for finding 55578 lines containing [Jesu] using CRT strstr()
389 ms  for finding 55578 lines containing [Jesu] using Masm32 find$()
300 ms  for finding 55578 lines containing [Jesu] using MB Instr_()
110 ms  for finding 55578 lines containing [Jesu] using faster Instr_()

364 ms  for finding 55460 lines containing [Jesus] using CRT strstr()
390 ms  for finding 55460 lines containing [Jesus] using Masm32 find$()
299 ms  for finding 55460 lines containing [Jesus] using MB Instr_()
113 ms  for finding 55460 lines containing [Jesus] using faster Instr_()

363 ms  for finding 44604 lines containing [Jesus ] using CRT strstr()
393 ms  for finding 44604 lines containing [Jesus ] using Masm32 find$()
301 ms  for finding 44604 lines containing [Jesus ] using MB Instr_()
111 ms  for finding 44604 lines containing [Jesus ] using faster Instr_()

368 ms  for finding 11328 lines containing [Jesus C] using CRT strstr()
390 ms  for finding 11328 lines containing [Jesus C] using Masm32 find$()
304 ms  for finding 11328 lines containing [Jesus C] using MB Instr_()
112 ms  for finding 11328 lines containing [Jesus C] using faster Instr_()

1018 ms total for faster Instr_(), 2401 ms for CRT, crt:mb=2.36
318     bytes for InstrJJw

dedndave

  • Member
  • *****
  • Posts: 8828
  • Still using Abacus 2.0
    • DednDave
Re: Instr() timings
« Reply #10 on: September 22, 2015, 10:48:25 PM »
prescott w/htt
Code: [Select]
Intel(R) Pentium(R) 4 CPU 3.00GHz
57 ms   for finding 2004761 lines containing [] using CRT strstr()
574 ms  for finding 0 lines containing [] using Masm32 find$()
624 ms  for finding 2004761 lines containing [] using MB Instr_()
66 ms   for finding 2004761 lines containing [] using faster Instr_()

308 ms  for finding 292404 lines containing [J] using CRT strstr()
554 ms  for finding 292404 lines containing [J] using Masm32 find$()
587 ms  for finding 292404 lines containing [J] using MB Instr_()
559 ms  for finding 292404 lines containing [J] using faster Instr_()

465 ms  for finding 165908 lines containing [Je] using CRT strstr()
564 ms  for finding 165908 lines containing [Je] using Masm32 find$()
520 ms  for finding 165908 lines containing [Je] using MB Instr_()
268 ms  for finding 165908 lines containing [Je] using faster Instr_()

478 ms  for finding 61360 lines containing [Jes] using CRT strstr()
578 ms  for finding 61360 lines containing [Jes] using Masm32 find$()
542 ms  for finding 61360 lines containing [Jes] using MB Instr_()
282 ms  for finding 61360 lines containing [Jes] using faster Instr_()

479 ms  for finding 55578 lines containing [Jesu] using CRT strstr()
580 ms  for finding 55578 lines containing [Jesu] using Masm32 find$()
538 ms  for finding 55578 lines containing [Jesu] using MB Instr_()
280 ms  for finding 55578 lines containing [Jesu] using faster Instr_()

482 ms  for finding 55460 lines containing [Jesus] using CRT strstr()
580 ms  for finding 55460 lines containing [Jesus] using Masm32 find$()
542 ms  for finding 55460 lines containing [Jesus] using MB Instr_()
285 ms  for finding 55460 lines containing [Jesus] using faster Instr_()

482 ms  for finding 44604 lines containing [Jesus ] using CRT strstr()
567 ms  for finding 44604 lines containing [Jesus ] using Masm32 find$()
544 ms  for finding 44604 lines containing [Jesus ] using MB Instr_()
278 ms  for finding 44604 lines containing [Jesus ] using faster Instr_()

488 ms  for finding 11328 lines containing [Jesus C] using CRT strstr()
567 ms  for finding 11328 lines containing [Jesus C] using Masm32 find$()
547 ms  for finding 11328 lines containing [Jesus C] using MB Instr_()
287 ms  for finding 11328 lines containing [Jesus C] using faster Instr_()

2305 ms total for faster Instr_(), 3239 ms for CRT, crt:mb=1.41

Siekmanski

  • Member
  • *****
  • Posts: 2622
Re: Instr() timings
« Reply #11 on: September 23, 2015, 05:02:36 AM »
Code: [Select]
Bible.txt downloaded
33979 lines found
Intel(R) Core(TM) i7-4930K CPU @ 3.40GHz
40 ms   for finding 2004761 lines containing [] using CRT strstr()
304 ms  for finding 0 lines containing [] using Masm32 find$()
249 ms  for finding 2004761 lines containing [] using MB Instr_()
23 ms   for finding 2004761 lines containing [] using faster Instr_()

140 ms  for finding 292404 lines containing [J] using CRT strstr()
264 ms  for finding 292404 lines containing [J] using Masm32 find$()
233 ms  for finding 292404 lines containing [J] using MB Instr_()
229 ms  for finding 292404 lines containing [J] using faster Instr_()

189 ms  for finding 165908 lines containing [Je] using CRT strstr()
274 ms  for finding 165908 lines containing [Je] using Masm32 find$()
207 ms  for finding 165908 lines containing [Je] using MB Instr_()
75 ms   for finding 165908 lines containing [Je] using faster Instr_()

198 ms  for finding 61360 lines containing [Jes] using CRT strstr()
281 ms  for finding 61360 lines containing [Jes] using Masm32 find$()
214 ms  for finding 61360 lines containing [Jes] using MB Instr_()
79 ms   for finding 61360 lines containing [Jes] using faster Instr_()

197 ms  for finding 55578 lines containing [Jesu] using CRT strstr()
280 ms  for finding 55578 lines containing [Jesu] using Masm32 find$()
215 ms  for finding 55578 lines containing [Jesu] using MB Instr_()
78 ms   for finding 55578 lines containing [Jesu] using faster Instr_()

198 ms  for finding 55460 lines containing [Jesus] using CRT strstr()
280 ms  for finding 55460 lines containing [Jesus] using Masm32 find$()
215 ms  for finding 55460 lines containing [Jesus] using MB Instr_()
78 ms   for finding 55460 lines containing [Jesus] using faster Instr_()

197 ms  for finding 44604 lines containing [Jesus ] using CRT strstr()
280 ms  for finding 44604 lines containing [Jesus ] using Masm32 find$()
216 ms  for finding 44604 lines containing [Jesus ] using MB Instr_()
77 ms   for finding 44604 lines containing [Jesus ] using faster Instr_()

200 ms  for finding 11328 lines containing [Jesus C] using CRT strstr()
280 ms  for finding 11328 lines containing [Jesus C] using Masm32 find$()
219 ms  for finding 11328 lines containing [Jesus C] using MB Instr_()
78 ms   for finding 11328 lines containing [Jesus C] using faster Instr_()

717 ms total for faster Instr_(), 1359 ms for CRT, crt:mb=1.90
318     bytes for InstrJJw
Creative coders use backward thinking techniques as a strategy.

TWell

  • Member
  • ****
  • Posts: 743
Re: Instr() timings
« Reply #12 on: September 23, 2015, 08:43:27 PM »
@jj2007
Can test that with strstr from pocrt.dll too?

sinsi

  • Guest
Re: Instr() timings
« Reply #13 on: September 23, 2015, 09:09:14 PM »
Code: [Select]
Bible.txt downloaded
33979 lines found
Intel(R) Core(TM) i7-4790 CPU @ 3.60GHz
18 ms   for finding 2004761 lines containing [] using CRT strstr()
186 ms  for finding 0 lines containing [] using Masm32 find$()
217 ms  for finding 2004761 lines containing [] using MB Instr_()
18 ms   for finding 2004761 lines containing [] using faster Instr_()

115 ms  for finding 292404 lines containing [J] using CRT strstr()
174 ms  for finding 292404 lines containing [J] using Masm32 find$()
201 ms  for finding 292404 lines containing [J] using MB Instr_()
197 ms  for finding 292404 lines containing [J] using faster Instr_()

152 ms  for finding 165908 lines containing [Je] using CRT strstr()
181 ms  for finding 165908 lines containing [Je] using Masm32 find$()
143 ms  for finding 165908 lines containing [Je] using MB Instr_()
60 ms   for finding 165908 lines containing [Je] using faster Instr_()

160 ms  for finding 61360 lines containing [Jes] using CRT strstr()
188 ms  for finding 61360 lines containing [Jes] using Masm32 find$()
146 ms  for finding 61360 lines containing [Jes] using MB Instr_()
63 ms   for finding 61360 lines containing [Jes] using faster Instr_()

159 ms  for finding 55578 lines containing [Jesu] using CRT strstr()
185 ms  for finding 55578 lines containing [Jesu] using Masm32 find$()
146 ms  for finding 55578 lines containing [Jesu] using MB Instr_()
60 ms   for finding 55578 lines containing [Jesu] using faster Instr_()

159 ms  for finding 55460 lines containing [Jesus] using CRT strstr()
189 ms  for finding 55460 lines containing [Jesus] using Masm32 find$()
147 ms  for finding 55460 lines containing [Jesus] using MB Instr_()
61 ms   for finding 55460 lines containing [Jesus] using faster Instr_()

160 ms  for finding 44604 lines containing [Jesus ] using CRT strstr()
187 ms  for finding 44604 lines containing [Jesus ] using Masm32 find$()
149 ms  for finding 44604 lines containing [Jesus ] using MB Instr_()
60 ms   for finding 44604 lines containing [Jesus ] using faster Instr_()

164 ms  for finding 11328 lines containing [Jesus C] using CRT strstr()
186 ms  for finding 11328 lines containing [Jesus C] using Masm32 find$()
150 ms  for finding 11328 lines containing [Jesus C] using MB Instr_()
62 ms   for finding 11328 lines containing [Jesus C] using faster Instr_()

581 ms total for faster Instr_(), 1087 ms for CRT, crt:mb=1.87
318     bytes for InstrJJw

jj2007

  • Member
  • *****
  • Posts: 13651
  • Assembly is fun ;-)
    • MasmBasic
Re: Instr() timings
« Reply #14 on: September 23, 2015, 09:25:34 PM »
@jj2007
Can test that with strstr from pocrt.dll too?

Here it is - note that in order to see Pelles C results, pocrt.dll must be in the path:
Code: [Select]
33979 lines found
Intel(R) Core(TM) i5-2450M CPU @ 2.50GHz
206 ms  for finding 1465185 lines containing [the] using CRT strstr()
285 ms  for finding 1465185 lines containing [the] using Masm32 find$()
252 ms  for finding 1465185 lines containing [the] using PellesC strstr
157 ms  for finding 1489830 lines containing [the] using MB Instr_()
111 ms  for finding 1489830 lines containing [the] using faster Instr_()

467 ms  for finding 418276 lines containing [ther] using CRT strstr()
491 ms  for finding 418276 lines containing [ther] using Masm32 find$()
648 ms  for finding 418276 lines containing [ther] using PellesC strstr
359 ms  for finding 442232 lines containing [ther] using MB Instr_()
176 ms  for finding 442232 lines containing [ther] using faster Instr_()

510 ms  for finding 205004 lines containing [there] using CRT strstr()
523 ms  for finding 205004 lines containing [there] using Masm32 find$()
710 ms  for finding 205004 lines containing [there] using PellesC strstr
392 ms  for finding 233995 lines containing [there] using MB Instr_()
176 ms  for finding 233995 lines containing [there] using faster Instr_()

545 ms  for finding 42771 lines containing [theref] using CRT strstr()
523 ms  for finding 42771 lines containing [theref] using Masm32 find$()
761 ms  for finding 42771 lines containing [theref] using PellesC strstr
419 ms  for finding 65402 lines containing [theref] using MB Instr_()
181 ms  for finding 65402 lines containing [theref] using faster Instr_()

542 ms  for finding 42665 lines containing [therefo] using CRT strstr()
525 ms  for finding 42665 lines containing [therefo] using Masm32 find$()
760 ms  for finding 42665 lines containing [therefo] using PellesC strstr
420 ms  for finding 65296 lines containing [therefo] using MB Instr_()
180 ms  for finding 65296 lines containing [therefo] using faster Instr_()

542 ms  for finding 42665 lines containing [therefor] using CRT strstr()
535 ms  for finding 42665 lines containing [therefor] using Masm32 find$()
761 ms  for finding 42665 lines containing [therefor] using PellesC strstr
420 ms  for finding 65296 lines containing [therefor] using MB Instr_()
181 ms  for finding 65296 lines containing [therefor] using faster Instr_()

548 ms  for finding 42665 lines containing [therefore] using CRT strstr()
536 ms  for finding 42665 lines containing [therefore] using Masm32 find$()
762 ms  for finding 42665 lines containing [therefore] using PellesC strstr
423 ms  for finding 65296 lines containing [therefore] using MB Instr_()
183 ms  for finding 65296 lines containing [therefore] using faster Instr_()

578 ms  for finding 42665 lines containing [therefore] using CRT strstr()
539 ms  for finding 42665 lines containing [therefore] using Masm32 find$()
762 ms  for finding 42665 lines containing [therefore] using PellesC strstr
423 ms  for finding 65296 lines containing [therefore] using MB Instr_()
183 ms  for finding 65296 lines containing [therefore] using faster Instr_()

1371 ms total for faster Instr_(), 3938 ms for CRT, crt:mb=2.87
364     bytes for InstrJJw

Line counts differ in this version:
Code: [Select]
578 ms  for finding 42665 lines containing [therefore] using CRT strstr()
183 ms  for finding 65296 lines containing [therefore] using faster Instr_()

The reason is that the new algo has the IntelliSense option, as in MasmBasic Instr_(). It allows to search for e.g. "therefore" as in the test run above, and to catch Therefore and therefore (but not tHereFore etc). This is evidently an important option for text searches.
« Last Edit: September 23, 2015, 11:46:57 PM by jj2007 »