• Welcome to Valhalla Legends Archive.
 

Speed Tests

Started by Ban, January 21, 2005, 07:12 PM

Previous topic - Next topic

Ban

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



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


It provided the following results:


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 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

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.

Stealth

#2
Quote from: Yegg on January 22, 2005, 02:14 PM
That's pretty difficult to look at but I think I got the idea.

Are you sure?

QuoteMaybe you could try using that to make the ultimate floodbot, 8>.

Maybe not. I'm pretty sure his aim is not to make a floodbot.
- Stealth
Author of StealthBot

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. :/

UserLoser.

Quote from: Yegg on January 22, 2005, 02:14 PM
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.

ReaperFlood?  Why are you using a "bot" which is infected with the Prorat Trojan

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...

Zakath

Serves you right for using floodbots. Frankly, I don't feel sorry for you at all.
Quote from: iago on February 02, 2005, 03:07 PM
Yes, you can't have everybody...contributing to the main source repository.  That would be stupid and create chaos.

Opensource projects...would be dumb.

Eric

#7
Quote from: Yegg on January 22, 2005, 02:14 PM
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.

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>

Arta


Ban

Quote from: Yegg on January 22, 2005, 02:14 PM
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.

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.
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 :\

Ban

Updated the code by removing DoEvents (was uneeded):


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



Updated results are much more interesting:

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

EpicOfTimeWasted

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);


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+:

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

Ban

Hmm... intersting, the speed differnces o_0

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.