DataOptimizer Class
The data optimizer is to optimize data structures coming from data files to make processing faster. One way of optimization for example is to convert regular array to typed arrays.
Item Index
Methods
- arrayToNativeArray static
- nativeArray16 static
- nativeArray16 static
- optimizeCommand static
- optimizeCommonEventCall static
- optimizeCommonEventCall static
- optimizeEventCommands static
- optimizeVariableAccess static
- removeEmptyCommand static
Methods
arrayToNativeArray
-
array
Converts the specified number-array to a typed Int16 array.
Parameters:
-
array
Array- The array to convert.
Returns:
The typed array.
nativeArray16
-
size
Creates a typed Int16 array if supported. Otherwise a regular array is created.
Parameters:
-
size
Number- The size of the array in elements.(Not in bytes).
Returns:
The Int16 array.
nativeArray16
-
size
Creates a typed Int8 array if supported. Otherwise a regular array is created.
Parameters:
-
size
Number- The size of the array in elements.(Not in bytes).
Returns:
The Int8 array.
optimizeCommand
-
commands
-
index
-
command
Optimizes a single command.
Parameters:
-
commands
Object- A list of commands.
-
index
Number- Index of the command in command-list.
-
command
Object- The command to optimize.
optimizeCommonEventCall
-
commands
-
index
-
command
Checks if a common event call can be optimized by inline it. In special cases, such as recursion or parameters, an optimization is no possible.
Parameters:
-
commands
Object- A list of commands.
-
index
Number- Index of the command in command-list.
-
command
Object- The command to optimize.
Returns:
If true the call can be safly inline. Otherwise false
optimizeCommonEventCall
-
commands
-
index
-
command
Optimizes a common event call.
Parameters:
-
commands
Object- A list of commands.
-
index
Number- Index of the command in command-list.
-
command
Object- The command to optimize.
optimizeEventCommands
-
commands
Optimizes a list of event/scene commands by removing unnecessary commands like comments or empty commands. It also optimizes label jumps. Adds an optimized to the specified command-list to indicate that the list was already optimized. If optimized property of command-list is set to true this method will return immediately.
Parameters:
-
commands
Object- A list of commands to optimize.
optimizeVariableAccess
-
data
Optimizes the variable-access by replacing the domain-string with the domain-index value at runtime to allow faster domain access using integer numbers instead of strings.
Parameters:
-
data
Object- The data to opimize, e.g. the params-object of a command.
removeEmptyCommand
-
commands
-
command
Removes a single empty command like a comment.
Parameters:
-
commands
Object- A list of commands.
-
command
Object- The command to optimize.