1
0
Fork 0

Added result explanations to method invocation performance tests

closure/master
Mike Gerwitz 2011-03-11 19:27:07 -05:00
parent 5a420fae4e
commit 05e249def4
1 changed files with 12 additions and 2 deletions

View File

@ -1,8 +1,18 @@
/**
* Tests amount of time taken to invoke Class methods
*
* Results are assigned to a var to ensure V8 doesn't optimize the calls too
* much.
* The expected results are as follows:
* - Method invocations are expected to be slower than invoking a method on a
* conventional constructor instance. This is because of the method wrapper
* used by ease.js.
* - Public methods externally should be invoked very quickly. They are part
* of the class's prototype and therefore easily accessible.
* - Public methods /internally/ are likely to be invoked slightly more
* slowly. This is because it takes one extra step down the prototype chain
* to access them. The difference should be minute.
* - Protected and private methods internally should be accessed fairly
* quickly since, like public methods externally, they are first on the
* prototype chain.
*
* Copyright (C) 2010 Mike Gerwitz
*