[INFO] Compilation of Math for your bot menu

User Tag List

Page 2 of 2 FirstFirst 12
Results 16 to 27 of 27
  1. #16
    xalcon's Avatar Contributor ふたなり
    Authenticator enabled
    Reputation
    198
    Join Date
    Oct 2008
    Posts
    291
    Thanks G/R
    20/58
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by Musah View Post
    but even a puny one as me knows that the more tasks you give to the processor the slower it runs
    Oh, realy? Didn't knew that :3 my CPU doesn't run slower, the more it needs to do :P It's always running at 2.6 GHz...

    ok, back to topic:
    well, there are alot of ways to get the nearest object compared to another object. I've done some benchmarks some weeks ago, and you SHOULD implement a getDistance()-Method, which returns the non-sqrt value of the distance. It's around 100% faster, then calculating the "real" distance.. well, at least when using the loop version and a very high amount of objects :P
    Code:
    Nearest object - Objectcount int posList: 1000000
    Nearest via LinqFind - with square root: 731ms
    Nearest via LinqFind - without square root: 687ms
    Nearest via LoopFind - with square root: 75ms
    Nearest via LoopFind - without square root: 37ms
    Using Microsoft Linq may not be the fastest, but the easiest to change and understand:
    Code:
    Vector3D nearest =
                    (from v in posList
                     orderby v.getDistance(me)
                     select v).First();

    [INFO] Compilation of Math for your bot
  2. #17
    suicidity's Avatar Contributor
    Reputation
    207
    Join Date
    Oct 2006
    Posts
    1,439
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Funny, because my results are drastically different. Looping over 1000000 objects like you..

    Code:
    Length() took 67.7275ms
    Shortest length 0.01256103
    LengthSq() took 7.6812ms
    Shortest length 0.0001577795
    That's 88.65% faster.


  3. #18
    streppel's Avatar Active Member
    Reputation
    78
    Join Date
    Mar 2007
    Posts
    196
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just did try it myself:
    ~0.022ms per object(including creating random numbers for the coords!) with sqrt
    ~0.0217ms per object without sqrt...(and with rnd coords again)

    isn't sqrt a cpu function? so i shouldn't be too much of a problem for the cpu to calculate it

  4. #19
    Bananenbrot's Avatar Contributor
    Reputation
    153
    Join Date
    Nov 2009
    Posts
    384
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But even the CPU has to approximate them. I really doubt there is a lookup for that.

    Ahh.. google says c++ practical computational complexity of <cmath> SQRT() - Stack Overflow the answer is enlightening.

    Why the heck are you actually benchmarking object distance computations? :P

  5. #20
    streppel's Avatar Active Member
    Reputation
    78
    Join Date
    Mar 2007
    Posts
    196
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    cause they were arguing about wether it was faster to do object sorting by distance WITH or w/o squareroot...so this now means that either way it's so damned fast that you won't ever need to care about it in a real world application

  6. #21
    Bananenbrot's Avatar Contributor
    Reputation
    153
    Join Date
    Nov 2009
    Posts
    384
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yeah I know... and I wasn't blaming anyone (especially you) for it^^
    But isn't it enough to know THAT it's faster, rather than measure it on a hypothetical 1.000.000 objects (whereever you get them from)?

  7. #22
    streppel's Avatar Active Member
    Reputation
    78
    Join Date
    Mar 2007
    Posts
    196
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ofc it is...now let's cut this discussion and better stick to the topic before one of them mods forces us to do so

  8. #23
    Musah's Avatar Corporal
    Reputation
    3
    Join Date
    Sep 2011
    Posts
    24
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally Posted by xalcon View Post
    *snip*
    Not using C# So Am using a loop not Linq ^_^
    Thanks for benchmarking those results for me. I'll get rid of the sqrt ASAP.

    ---------- Post added at 07:50 PM ---------- Previous post was at 07:47 PM ----------

    Originally Posted by suicidity View Post
    Funny, because my results are drastically different. Looping over 1000000 objects like you..

    Code:
    Length() took 67.7275ms
    Shortest length 0.01256103
    LengthSq() took 7.6812ms
    Shortest length 0.0001577795
    That's 88.65% faster.
    This leaves me confused.

  9. #24
    xalcon's Avatar Contributor ふたなり
    Authenticator enabled
    Reputation
    198
    Join Date
    Oct 2008
    Posts
    291
    Thanks G/R
    20/58
    Trade Feedback
    0 (0%)
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    1000000 objects were only a test. My intention was to test how fast i could get the nearest object out of aprox 5000 objects... it was done in around 1 ms without sqrt and 3ms with sqrt... but this was on my notebook :P
    Originally Posted by Musah View Post
    Not using C# So Am using a loop not Linq ^_^
    Thanks for benchmarking those results for me. I'll get rid of the sqrt ASAP.

    ---------- Post added at 07:50 PM ---------- Previous post was at 07:47 PM ----------


    This leaves me confused.
    me too o.O" why is your sqrt() distance function faster then the function without it? what the heck are you doin? are you sure that you've benched the right functions? ^^

  10. #25
    Bananenbrot's Avatar Contributor
    Reputation
    153
    Join Date
    Nov 2009
    Posts
    384
    Thanks G/R
    1/3
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Length() is obviously sqrt(LengthSq()). So this shouldn't confuse you that much.

    Interpreting suicidity's and your results and considering my SO link, your differences could stem from the fact that suicidity used a generally faster (read more optimized) algorithm (maybe some stuff like stackalloc etc.), but had an older CPU (sqrt uses more cycles in relation to other copmutations).
    Last edited by Bananenbrot; 09-30-2011 at 05:27 AM.

  11. #26
    Musah's Avatar Corporal
    Reputation
    3
    Join Date
    Sep 2011
    Posts
    24
    Thanks G/R
    0/0
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Guess it's subjective to the computer. Only use what's fastest for you. Will benchmark results.

    Code:
    011-09-30 09:58:26.105 DevSpicket[73693:707] Let's populate 100000 false objects.
    2011-09-30 09:58:26.302 DevSpicket[73693:707] Population complete after 0.197572 seconds.
    2011-09-30 09:58:26.398 DevSpicket[73693:707] Found the closest Object after 0.093588 seconds without sqrt.
    2011-09-30 09:58:26.509 DevSpicket[73693:707] Found the closest Object after 0.110844 seconds using sqrt.
    Last edited by Musah; 09-30-2011 at 08:59 AM.

  12. #27
    streppel's Avatar Active Member
    Reputation
    78
    Join Date
    Mar 2007
    Posts
    196
    Thanks G/R
    0/1
    Trade Feedback
    0 (0%)
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well,in a real world program i think i would go for doing it without the sqrt to sort the objects by distance and afterwards only calculate the real distance with sqrt for the 4 or 5 nearest objects so i already know my next targets and their distance,travel time,etc

Page 2 of 2 FirstFirst 12

Similar Threads

  1. [Selling] Dedicated Server for your bots (WOW,AA...)
    By dinya24 in forum ArcheAge Buy Sell Trade
    Replies: 2
    Last Post: 09-10-2015, 04:02 PM
  2. [Selling] Dedicated Server for your bots (WOW,AA...)
    By dinya24 in forum World of Warcraft Buy Sell Trade
    Replies: 0
    Last Post: 10-18-2014, 11:25 AM
  3. [Selling] Dedicated Server for your bots (WOW,AA...)
    By dinya24 in forum World of Warcraft Buy Sell Trade
    Replies: 1
    Last Post: 09-25-2014, 11:27 AM
  4. Replies: 18
    Last Post: 10-19-2012, 03:46 PM
  5. do you use VPN for your bot?
    By triel559 in forum WoW Bots Questions & Requests
    Replies: 1
    Last Post: 08-07-2012, 03:36 PM
All times are GMT -5. The time now is 03:25 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search