Thread: Cinema Workshop
View Single Post
Old 07-04-2011, 12:38 PM   #9
Anitarf
Procrastination Incarnate


Development Director
 
Join Date: Feb 2004
Posts: 8,190

Submissions (19)

Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)Anitarf has a brilliant future (903)

2008 Spell olympics - Fire - SilverApproved Map: Old School Alliance TacticsHero Contest #2 - 3rd PlaceSpell making session 2 winner

Default

Quote:
Originally Posted by Captain Griffen
Why would you be very sure of that? Consider that we aren't just dealing with a VM, we're dealing with a Blizzard VM.
We'd need to test this in a map where you can easily switch between having no and a few hundred declared variables/arrays (by the use of nested textmacros) and then do a hundred get/set operations (again with textmacros, no loops) and test how long that takes depending on the number of global variables in the map and depending on whether the get/set operations are being done on a global or a local, so four test cases in total. Someone with a working japi would need to do this since I don't trust fps tests with something as fast as variable operations, but this is really a subject for a new thread.

Quote:
Originally Posted by BBQ
As far as I know, when using a local array, 32 kilobytes of memory (4 bytes per array slot, 8192 slots) would be allocated each time the function starts, and deallocated when the function returns. In the case of a global array, 32 kilobytes of memory would be allocated upon map initialization, and never deallocated.
It was my understanding that arrays were allocated incrementally as needed, but maybe I misunderstood what this post says. In either case, if local variables are indeed faster than globals when there are many globals in the map then this is a moot point as the amount of operations I do on the local array should out-weight the cost of its allocation.

Quote:
Originally Posted by BBQ
Perhaps you could use a linked list (similar to the one in grim001's ListModule) instead of an array when looping through the struct instances in the Transition library.
I could do that, but the speed gain would be insignificant. If I was having performance issues with Transition, the first thing I would do would be to rewrite UnitPositionTransition, since that one is likely to see the most use and its onTransition method is uninlineable, so I would copy&paste the Transition code into it instead of implementing the module so that I could inline the onTransition method manually. If I were to go this far, then it would make sense to also use grim001's module, but considering how ugly this solution is I would rather not go this far unless I need to.
__________________
Anitarf is offline   Reply With Quote