Valhalla Legends Forums Archive | General Programming | Speed Tests

AuthorMessageTime
Ban
I recently conducted a speed test of the Visual Basic 6 language.
Here is the coding I used for my test.


[code]
Option Explicit
'API Declares
Private Declare Function QueryPerformanceCounter Lib "kernel32" (lpPerformanceCount As Currency) As Long

Private Declare Function QueryPerformanceFrequency Lib "kernel32" (lpFrequency As Currency) As Long


Sub Main()
Dim A As Currency, B As Currency, C As Currency, I As Integer, Overhead As Currency, D As Long
QueryPerformanceCounter A 'Overhead Begin Check
QueryPerformanceCounter B 'Overhead End Check
Overhead = B - A 'Detect the amount of api overhead
For I = 1 To 20 'Give us 20 results
QueryPerformanceCounter A 'Get start time
    Do
        D = D + 1 'Increase loop count
        QueryPerformanceCounter B 'Check current time
        DoEvents 'Provide time for execution
    Loop While B - A - Overhead < 2990 'Check to see if we have reached 2990ms (my target)
    C = B - A - Overhead 'Save time taken to C for displaying in the output
    Debug.Print A; "    "; B; " "; C; " "; D 'Display results of this loop in the Intermediate window
Next 'continue looping
End Sub
[/code]

It provided the following results:

[code]
Start Time          End Time      Time Taken  Total Loops

36874436.9618      36877426.9630  2990.0003  1171845
36877428.5441      36880418.5454  2990.0004  2456835
36880418.9904      36883409.0373  2990.0460  3908549
36883409.4670      36886399.4691  2990.0012  5355181
36886399.9275      36889389.9291  2990.0007  6817252
36889390.4151      36892380.4162  2990.0002  8254931
36892380.9635      36895371.0960  2990.1316  9724499
36895371.5990      36898361.6005  2990.0006  11117215
36898361.9892      36901351.9908  2990.0007  12556542
36901352.4753      36904342.4776  2990.0014  13994217
36904342.9587      36907332.9603  2990.0007  15456185
36907333.5126      36910323.5420  2990.0285  16917808
36910324.0560      36913315.4849  2991.4280  18391715
36913315.9670      36916305.9687  2990.0008  19868488
36916306.5344      36919296.5365  2990.0012  21350556
36919297.0458      36922287.0482  2990.0015  22802043
36922287.5463      36925277.5479  2990.0007  24273989
36925278.0417      36928268.0434  2990.0008  25752879
36928268.6307      36931258.6328  2990.0012  27233966
36931259.1552      36934249.1562  2990.0001  28727857
[/code]

Code was run on Microsoft Windows XP Pro, with 512MB RAM and a 1.15GHz AMD Athlon Processor

Time Taken is the amount of time it took to meet the > 2990 value.
Total Loops is the number of loops it took to meet that time.
From here, you can estimate that one loop took approximatly
2990.08233 / 13444929.3 = 2.2239107869462727483438681972095e-4ms each
so somewhere close to 0.0002ms for a loop.

As we increased I, you can see that the number of loops increased. It appears as though more CPU
and/or RAM is being allocated as our for...next loop continues.

So far the only mistake I can think of right here is that perhaps it should have been:
"Loop While B - A - ((Overhead / 2) * D) < 2990" to account for the number of
"QuerySystemPerformance B" calls, do the same to "C = B - A - Overhead", dividing the regular overhead by 2 assuming that
the api overhead for two calls is 1/2 that for one. If anyone wants to try it with that
fix, please do so and post your results.

I would be interested to see results from other languages. 8)

EDIT: Typo, Sys Info
January 22, 2005, 1:12 AM
Yegg
That's pretty difficult to look at but I think I got the idea. Maybe you could try using that to make the ultimate floodbot, 8>. I was recently doing some speed tests in Python, I did a few simple tests on battle.net for its speed. My bot managed to send 4 messages in 180ms time. This far surpassed AdvancedFlood and MiscFlood, I never recorded how fast ReaperFlood was so I wouldn't know. Well, have fun with those speed tests.
January 22, 2005, 8:14 PM
Stealth
[quote author=Yegg link=topic=10263.msg96192#msg96192 date=1106424848]
That's pretty difficult to look at but I think I got the idea.[/quote]

Are you sure?

[quote]Maybe you could try using that to make the ultimate floodbot, 8>.[/quote]

Maybe not. I'm pretty sure his aim is not to make a floodbot.
January 22, 2005, 8:37 PM
Yegg
Well, making it an "ultimate" floodbot was just a joke. Also, the parts that wus hard to look at what was under Start Time          End Time      Time Taken  Total Loops, whenever I see decimals I start to get lost. :/
January 22, 2005, 11:46 PM
UserLoser.
[quote author=Yegg link=topic=10263.msg96192#msg96192 date=1106424848]
That's pretty difficult to look at but I think I got the idea. Maybe you could try using that to make the ultimate floodbot, 8>. I was recently doing some speed tests in Python, I did a few simple tests on battle.net for its speed. My bot managed to send 4 messages in 180ms time. This far surpassed AdvancedFlood and MiscFlood, I never recorded how fast ReaperFlood was so I wouldn't know. Well, have fun with those speed tests.
[/quote]

ReaperFlood?  Why are you using a "bot" which is infected with the Prorat Trojan
January 23, 2005, 2:22 AM
Yegg
Just for saying that userloser, I'm going to kill the maker of that bot. Now I know where I got it from. Wtf...
January 23, 2005, 3:31 AM
Zakath
Serves you right for using floodbots. Frankly, I don't feel sorry for you at all.
January 24, 2005, 3:15 PM
LoRd
[quote author=Yegg link=topic=10263.msg96192#msg96192 date=1106424848]
That's pretty difficult to look at but I think I got the idea. Maybe you could try using that to make the ultimate floodbot, 8>. I was recently doing some speed tests in Python, I did a few simple tests on battle.net for its speed. My bot managed to send 4 messages in 180ms time. This far surpassed AdvancedFlood and MiscFlood, I never recorded how fast ReaperFlood was so I wouldn't know. Well, have fun with those speed tests.
[/quote]

If you wanted to, you could jam 4 chat messages together and then send them in a single stream thus having all 4 messages reach Battle.net at the exact same time.  Unless you have an extremely poorly coded bot, it shouldn't take any longer than maybe a millisecond to generate the data to send.  From there, it's the work of the Kernel and TCP/IP's underlying protocols to determine when to send the data and finally, your internet connection & the distance from the server which determines how long it takes the data to reach the server.

Perhaps if these dumb dumb's who make floodbots now-a-days actually understood how their programs worked, they could make much more efficient ones.

</off-topic rambling>
January 24, 2005, 4:09 PM
Arta
Off-topic:

[quote author=LoRd[nK] link=topic=10263.msg96431#msg96431 date=1106582998]
dumb dumb's
[/quote]

lol *grin*
January 24, 2005, 4:43 PM
Ban
[quote author=Yegg link=topic=10263.msg96192#msg96192 date=1106424848]
That's pretty difficult to look at but I think I got the idea. Maybe you could try using that to make the ultimate floodbot, 8>. I was recently doing some speed tests in Python, I did a few simple tests on battle.net for its speed. My bot managed to send 4 messages in 180ms time. This far surpassed AdvancedFlood and MiscFlood, I never recorded how fast ReaperFlood was so I wouldn't know. Well, have fun with those speed tests.
[/quote]

My aim was nowhere even near to wanting to make a floodbot. I simply wanted to see how fast the Visual Basic 6 language is able to operate. There is a REASON as to why this was not posted under the Battle.net Bot Development Forum, but rather General Programming. I wanted to see if anyone else was willing to port the code I provided to another language so as we could compare their speeds.

Yegg, where the HELL did I ever say floodbot, or bot, or chat, or sending data, anywhere in my original post? You really should have READ IT before posting a response. Obviously you can't respond to the last portion:
[quote]
I would be interested to see results from other languages.
[/quote]
as you are stuck on making and using floodbots, one of the worst things that has come out of battle.net. If anyone else would like to post something relative (such as results from your own test, in a differn't language than VB6) then please do so, otherwise please avoid the offtopic shit. I wanted a seroius post :\
January 24, 2005, 6:53 PM
Ban
Updated the code by removing DoEvents (was uneeded):

[code]
Option Explicit
Private Declare Function QueryPerformanceCounter Lib "kernel32" (lpPerformanceCount As Currency) As Long

Sub Main()
Dim A As Currency, B As Currency, C As Currency, I As Integer, Overhead As Currency, D As Long, Res1, Res2
Debug.Print " Start Time          End Time      Time Taken  Total Loops"
QueryPerformanceCounter A 'Overhead Begin Check
QueryPerformanceCounter B 'Overhead End Check
Overhead = B - A 'Detect the amount of api overhead
For I = 1 To 20 'Give us 20 results
QueryPerformanceCounter A 'Get start time
    Do
        D = D + 1 'Increase loop count
        QueryPerformanceCounter B 'Check current time
    Loop While B - A - Overhead < 2990 'Check to see if we have reached 2990ms (my target)
    C = B - A - Overhead 'Save time taken to C for displaying in the output
    Res1 = Res1 + D
    Res2 = Res2 + (B - A - Overhead)
    Debug.Print A; "    "; B; " "; C; " "; D 'Display results of this loop in the Intermediate window
Next 'continue looping
Debug.Print "Total Loops:"; Res1
Debug.Print "Total Time:"; Res2
End Sub

'Modifications: Removed the DoEvents, added Res1 and Res2
[/code]


Updated results are much more interesting:
[code]
Start Time          End Time      Time Taken  Total Loops
42290463.7309      42293453.732  2990  6791856
42293454.0509      42296444.0522  2990.0002  13690433
42296445.4147      42299435.416  2990.0002  20530533
42299435.7162      42302425.7175  2990.0002  27464043
42302426.0454      42305416.0466  2990.0001  34401151
42305416.344      42308406.3453  2990.0002  41128451
42308406.6358      42311396.6371  2990.0002  47984209
42311396.9377      42314386.9391  2990.0003  54803339
42314387.2441      42317377.2453  2990.0001  61686177
42317377.5603      42320367.5614  2990  68572489
42320367.8703      42323357.8716  2990.0002  75366375
42323358.1745      42326348.1757  2990.0001  82102573
42326348.4808      42329338.754  2990.2721  88968058
42329339.0641      42332329.0654  2990.0002  95730819
42332329.3716      42335319.3729  2990.0002  102575550
42335319.6735      42338309.6748  2990.0002  108860578
42338310.0337      42341300.0351  2990.0003  115444073
42341300.3329      42344290.3342  2990.0002  122199147
42344290.6392      42347280.6406  2990.0003  129127116
42347280.9757      42350270.9768  2990  135768016
Total Loops: 1433194986
Total Time: 59800.2753
[/code]
January 26, 2005, 12:59 AM
EpicOfTimeWasted
[code]timeval codeTimerStart, overheadTimer;
double loopRunTime, totalRunTime, overhead = 0;
StartCodeTimer(codeTimerStart);
StartCodeTimer(overheadTimer);
overhead = StopCodeTimer(overheadTimer);
overhead = StopCodeTimer(codeTimerStart);
fprintf(stdout, "Time taken  Total loops\n");
unsigned long numLoops, totalLoops = 0;
for(int i = 0; i != 20; i++) {
  StartCodeTimer(codeTimerStart);
  do {
    ++numLoops;
    loopRunTime = StopCodeTimer(codeTimerStart) - overhead;
  } while(loopRunTime < 2.990);
  totalLoops += numLoops;
  totalRunTime += loopRunTime;
  fprintf(stdout, "%.4f    %d\n", loopRunTime * 1000, numLoops);
}
fprintf(stdout, "Total time: %.8f\nTotal loops: %u\n", totalRunTime * 1000, totalLoops);[/code]

Start/StopCodeTimer use gettimeofday(), which is accurate to 1ms (I'm not going to rebuild the kernel to get higher resolution), and returns the number of seconds elapsed (hence the * 1000).  C program running on FreeBSD 5.3-RELEASE, amd64 3200+:

[code]Time taken  Total loops
2990.0000    12705812
2990.0007    25401473
2990.0000    38046317
2990.0007    50896125
2990.0000    63933641
2990.0000    76968490
2990.0000    90002345
2990.0000    102761145
2990.0000    115795094
2990.0007    128558073
2990.0000    141261594
2990.0000    153967682
2990.0010    167003450
2990.0000    180037278
2990.0000    193074813
2990.0000    206109614
2990.0000    219143268
2990.0000    232180392
2990.0000    245040268
2990.0007    257852328
Total time: 59800.00400543
Total loops: 2700739202[/code]
January 26, 2005, 2:56 AM
Ban
Hmm... intersting, the speed differnces o_0
January 26, 2005, 5:04 AM
Adron
Your loops are too small to really measure language speed, considering they also include a call to an API function. You're measuring the time that API function takes to run. Write some more complicated native language code and time that, in a loop without any calls to timing functions.
January 26, 2005, 7:53 AM

Search