Show in Contents
Add to Favorites
Home: Alias Help
Detecting the Escape Key
Using the API
Using view frames
Making your code run faster
Two simple coding practices
can make a plug-in or OpenModel application run faster. These ideas
are stated elsewhere in the API documentation but are worth repeating
here. Adhering to these coding practices are even more important
if your code will be dealing with large numbers of objects.
- Where possible, utilize the destructive
wrapper methods such as nextD() or prevD() to iterate over objects.
The destructive methods re-use the wrapper object so no memory allocation
and destruction needs to be performed to iterate to another object.
- Turn off updating until you have finished
a batch of changes. Many classes contain a doUpdates( boolean newState
) method. Before going into a batch of geometry changes, call doUpdates(
FALSE ) to turn off updating. After the batch of geometry changes,
call doUpdates( TRUE ) to update any changed object.
An additional coding
practice that can be utilized is wherever possible takes advantage of
methods that perform operations on multiple objects. Some of the
batch routines are described above. These include creating and deleting
keyframes.