|
|
Ajax Perf - comparing the Atlas and Prototype class idioms
|
12/21/2005, By Jon Meyer
|
For a performance-critical class, set frequently accessed properties/methods directly on the this instance rather than placing them further up the prototype chain.
The Prototype idiom, generally speaking, produces code that runs marginally slower on IE, when doing general-case method/property access.
The Atlas idiom has the benefit of truly "private" instance variables - you can use closures to define variables that are only visible within a specific method. There appears to be no perf penality for accessing/updating these closure variables.
A major drawback of the Atlas approach is that constructing instances takes much longer. For a class where thousands of instances are constructed (e.g. a IsoDate class), this is a significant issue. For a class that is constructed once and lives the lifetime of the app, this may not be an issue.
Read Full Article
|
Rate this Ajax Articles
Rating: 0.0 out of votes cast
| |
|
|
|
|
|
|
|
|
|
|
|
|