Home World Forum
Stars! AutoHost web forums

Jump to Stars! AutoHost


 
 
Home » Stars! Clones, Extensions, Modding » FreeStars » Efficient Algorithm for Scanning planets/fleets/etc.
Re: Efficient Algorithm for Scanning planets/fleets/etc. Fri, 09 February 2007 11:55 Go to previous messageGo to previous message
sirgwain is currently offline sirgwain

 
Senior Chief Petty Officer

Messages: 86
Registered: March 2004
Location: Tucson
Quote:


Uhh... i did not say that switch to C. Shocked C++ is similar enough with C# and whatever they say ... C++ does calculations about 5 times quicker than C#.



You got me curiuous. I had always heard C# was approx the same speed, but never done any research on it. I did a little code test to see what my results were. I wrote a simple console app in C++ and C# to do this:

   double d1 = 0.727272;
   double d2 = 0.26252;
   double d3 = 343432.232;

   for (int i = 0; i < 100000000; i++)
   {

      d3 = d1 * d2;
      d1 = d3 * d2;
      d2 = d2 * d2;
      d3 = d1 * d2;
      d3 = d3 * d2;
   }


The C# time was between 595 ms and 607 ms. The C++ time was between 594 ms and 598 ms. That doesn't quite seem like a factor of 5 difference to me. Smile

Obviously the more complicated the code the more crap C# is going to throw on top of things (like in Windows forms and using complicated data structures), but the language speed itself is equivalent in speed for doing raw calculations.

Report message to a moderator

 
Read Message icon5.gif
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: New stars! server clone proposal
Next Topic: 3D tool
Goto Forum:
  


Current Time: Mon Apr 29 05:53:34 EDT 2024