mannyzhou5 / evolutionchamber

Automatically exported from code.google.com/p/evolutionchamber
0 stars 0 forks source link

Consider Updating State Types #156

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Currently we are using ints for all counters in the state class. Since we limit 
most buildings and units are limited by population the move to byte and short 
respectively should be considered.

Original issue reported on code.google.com by nafets...@gmail.com on 22 Nov 2010 at 8:02

GoogleCodeExporter commented 9 years ago
Did you try to profile how the changes affect memory usage and performance? I 
believe that would help but I'm interested how much it actually affects the 
overall performance.

Original comment by netpr...@gmail.com on 22 Nov 2010 at 10:04

GoogleCodeExporter commented 9 years ago
I think that "byte" would be too small for some fields because that only goes 
up to 127 and Starcraft's max supply is 200.  We could change them to "short", 
but I don't know if it would effect performance enough to be worth it.

Original comment by mike.angstadt on 22 Nov 2010 at 10:23

GoogleCodeExporter commented 9 years ago

Original comment by mike.angstadt on 22 Nov 2010 at 11:13

GoogleCodeExporter commented 9 years ago
I tried changing the state variables to shorts which resulted in a 0.5% - 1% 
increase in games played. So probably not worth it. Patch attached.

Original comment by nafets...@gmail.com on 24 Nov 2010 at 7:22

Attachments:

GoogleCodeExporter commented 9 years ago
Ran two tests to gauge performance.  I didn't notice much of a change either.

==========

Before running each test, I deleted the "etc" directory and restarted Evolution 
Chamber to avoid caching or memory issues that might effect performance.  Each 
test used 1 processor and ran for 20 seconds.  The average games played per 
second was calculated using code that I added to the application.

Test 1:
Final: 7 Mutas, +1 Flyer Attack

Test 2:
WP0: 6 Zerglings
WP1: 6 Roaches
WP2: 2 Hydralisks
WP3: 3 Overseers
Final: 7 Mutalisks, +1 Flyer Attack

==========

Before the patch (r132):
Test 1: 1634.1942080919769
Test 2: 1886.4467411107323

After the patch:
Test 1: 1648.5778077479133 (~0.8% increase)
Test 2: 1843.5850855350454 (~2% decrease)

Original comment by mike.angstadt on 3 Dec 2010 at 11:19

GoogleCodeExporter commented 9 years ago
Well it's mostly redundant with the new updates now since they'll be accessing 
the array.

Original comment by nafets...@gmail.com on 3 Dec 2010 at 11:36

GoogleCodeExporter commented 9 years ago
No longer valid due to architecture changes in the code base.
Thanks for the patch - it's still appreciated.

Original comment by netpr...@gmail.com on 20 Jul 2011 at 7:38