Author Topic: Averaging the Count/Timings -- a test  (Read 6789 times)

zedd151

  • Member
  • ****
  • Posts: 871
Re: Averaging the Count/Timings -- a test
« Reply #15 on: September 11, 2015, 06:02:03 PM »
quote from post #12 rrr314159:
Quote
> - Forum rules are, we can't make test runs for new guys.
What is this crock of crap ?

Thats alright hutch, I'm an old guy -  just turned 53, I just hide it better than rrr  8)

So, I didn't take offense.
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

jj2007

  • Member
  • *****
  • Posts: 10548
  • Assembler is fun ;-)
    • MasmBasic
Re: Averaging the Count/Timings -- a test
« Reply #16 on: September 11, 2015, 07:20:30 PM »
I tested your code and got - 0 ms 8)

What is maybe a bit surprising is that the low values tend to be at the beginning for this kind of exercise:

include \masm32\MasmBasic\MasmBasic.inc      ; download
  Init
  mov ebx, 999999      ; set high value for getting the minimum
  xor ecx, ecx
  xor edi, edi
  .Repeat
      NanoTimer()
      Let esi=FileRead$("\Masm32\include\Windows.inc")
      mov ebx, Min(ebx, NanoTimer(us))
      add edi, eax      ; sum up the timings
      Print Str$("%i ", eax)
      inc ecx
  .Until ecx>200
  Inkey Str$("\nMinimum=%i µs", ebx), Str$(", average=%i µs", edi/ecx)
  Exit
EndOfCode


Output:
585 613 1444 1476 4341 1505 2202 766 763 675 1001 1376 1447 849 953 1559 1793 1671 1576 1590 1740 1964 1803 1122 1051 888 867 980 779 82
9 892 1665 890 848 1521 1547 1528 1567 987 996 890 946 920 919 883 918 598 673 1259 1605 1217 1182 1443 1526 1399 1186 663 537 623 600 5
33 1305 1207 2526 1327 1226 1261 1359 1403 1617 1198 1441 1615 1682 889 1608 837 1023 782 1438 1675 864 1592 1735 902 840 1456 1788 895
814 880 839 783 887 902 823 887 880 1563 1576 1530 1569 988 1011 1099 971 1001 918 991 911 992 7211 853 901 895 906 1009 949 956 923 914
 1815 984 999 881 1309 987 918 950 974 970 1490 724 973 771 639 1450 1507 989 905 996 1092 871 1938 1573 1498 812 821 887 802 1457 1521
899 2852 818 810 904 819 881 1883 1691 1864 1483 1489 1523 914 904 1251 893 1452 1656 969 999 955 854 1442 1457 1527 1626 817 894 1665 1
453 1845 994 919 987 928 1532 1577 899 843 1700 895 775 785 898 1190 816 816 885
Minimum=533 µs, average=1206 µs

zedd151

  • Member
  • ****
  • Posts: 871
Re: Averaging the Count/Timings -- a test
« Reply #17 on: September 11, 2015, 07:35:43 PM »
Heres the results for my 'puter with your test.
Code: [Select]
2638 1823 2463 1865 2001 1988 2061 2516 2110 1977 1999 2069 1926 2004 2271 2260
2359 1982 2205 2127 2077 2430 1850 2675 1824 2432 1773 1792 2558 1763 2469 1791
1768 2466 1807 1772 1741 2452 1832 2193 2055 1960 1784 2469 1765 1771 2448 2163
2619 2145 1857 2033 1775 1750 1977 1773 1999 1751 1763 2007 1781 2338 1777 1766
2253 1752 1942 1743 2449 2083 1719 1735 2245 2236 2065 1958 2224 2179 2026 2239
1799 2289 2271 1778 1730 1983 1727 1765 1728 1994 1991 1719 1693 1818 2016 1864
1736 1964 1733 1757 1737 1774 1715 1942 1743 1726 1712 2010 1732 1704 1735 1752
1973 1737 1739 1992 1724 1742 1980 1732 2001 1740 1748 2221 1714 2130 1978 2196
2229 1760 1967 1737 2013 1986 1736 2247 1771 2039 2231 2059 2207 2210 2166 1986
2035 1974 1977 2035 1997 1818 1823 1848 1819 1837 1906 1816 1862 1479 1457 1508
1538 1490 1490 1673 1501 1497 1701 1771 1494 1660 1503 1426 1396 1607 1471 1454
1484 1490 1454 1492 1444 2772 1677 1297 1318 1550 1873 1778 1309 1966 1707 1788
1459 1618 1964 1818 1941 2475 2038 1673 2811
Minimum=1297 µs, average=1909 µs

Thats fine Jochen, thanks.   Did you also try the counter?

The timer I wasn't expecting anything grand from , I get

Code: [Select]
2319 ms lowest of 50 samples
 and my computer is slow 1.6 GHz.
figure a faster computer would show 1, 2, or even 0 like yours.

And for the counter I get
Code: [Select]
3700464 cycles lowest of 50 samples
oops, i posted the wrong numbers the first time = edited

with the test that was attached above
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

jj2007

  • Member
  • *****
  • Posts: 10548
  • Assembler is fun ;-)
    • MasmBasic
Re: Averaging the Count/Timings -- a test
« Reply #18 on: September 11, 2015, 07:41:16 PM »
Did you also try the counter?

3x14, 3*52... ::)

zedd151

  • Member
  • ****
  • Posts: 871
Re: Averaging the Count/Timings -- a test
« Reply #19 on: September 11, 2015, 07:56:10 PM »
::)


you don't have to roll your eyes, a no would have been sufficient.  :lol:

I only asked because the figures you gave were in ms, meaning they were from the timer

I edited the numbers in my post above, they were from a different test. oops!
I'm not always the sharpest knife in the drawer, but I have my moments.  :P

jj2007

  • Member
  • *****
  • Posts: 10548
  • Assembler is fun ;-)
    • MasmBasic
Re: Averaging the Count/Timings -- a test
« Reply #20 on: September 11, 2015, 08:11:16 PM »
you don't have to roll your eyes, a no would have been sufficient.  :lol:

The  ::) was not meant as a critique to you. The difference 14/52 just shows how tricky this business is...

zedd151

  • Member
  • ****
  • Posts: 871
Re: Averaging the Count/Timings -- a test
« Reply #21 on: September 11, 2015, 08:14:16 PM »
Okay  :lol:

Oh, your test appears to be only opening windows.inc...
Mine was opening, counting the lines then closing the file and freeing the memory.
I'm not always the sharpest knife in the drawer, but I have my moments.  :P