Code Optimisation – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
(Discussion about 'Global Array System' use and to be recommended in the article)
Line 2: Line 2:


Agree. ;)
Agree. ;)
Very good informations about how to make things work better. --[[User:SNKMAN|SNKMAN]] 22:51, 8 August 2010 (CEST)
Very good information about how to make things work better. --[[User:SNKMAN|SNKMAN]] 22:51, 8 August 2010 (CEST)
 
----
 
I want to open a discussion, if the use of the ''Global Array System'' should be recommended here at all<br>
or at least it needs the following points as comments to take into account when reading about it.
 
The system was originally developed to avoid the GV limit for savegames in OFP.<br>
This is no longer a problem, so no longer an argument to use this design.
 
Here are a couple of points we gather that argue against the use of this design:
 
1. '''Memory use'''
* We cannot really judge if it takes less memory, as we do not know the implementation.
* A large array itself may even take more; especially if not all elements are set.
* You can't undefine not used variables easily.
 
2. '''Performance'''
* Multiple selects from a huge array is most likely slower than referencing global variables.
* You always have to work with this monster of array.
* And use "select" and "set" to modify it instead of simple variable assignment.
 
3. '''Code design'''
* The array design is hard to read and to understand.
* The lack of variable naming makes it even worse.
 
Anyone is welcome to comment this. Ty. --[[User:Kju|Kju]] 08:30, 9 August 2010 (CEST)

Revision as of 08:30, 9 August 2010

This article is brilliant. Thank you --Doolittle 16:57, 28 April 2010 (CEST)

Agree. ;) Very good information about how to make things work better. --SNKMAN 22:51, 8 August 2010 (CEST)


I want to open a discussion, if the use of the Global Array System should be recommended here at all
or at least it needs the following points as comments to take into account when reading about it.

The system was originally developed to avoid the GV limit for savegames in OFP.
This is no longer a problem, so no longer an argument to use this design.

Here are a couple of points we gather that argue against the use of this design:

1. Memory use

  • We cannot really judge if it takes less memory, as we do not know the implementation.
  • A large array itself may even take more; especially if not all elements are set.
  • You can't undefine not used variables easily.

2. Performance

  • Multiple selects from a huge array is most likely slower than referencing global variables.
  • You always have to work with this monster of array.
  • And use "select" and "set" to modify it instead of simple variable assignment.

3. Code design

  • The array design is hard to read and to understand.
  • The lack of variable naming makes it even worse.

Anyone is welcome to comment this. Ty. --Kju 08:30, 9 August 2010 (CEST)