File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ Read [Code Snippets tutorial][1] and
1616* [ first-paint.js] ( first-paint.js ) - time from page reload to first visible contents.
1717* [ timing.js] ( timing.js ) - Detailed page timing information,
1818from [ addyosmani/timing.js] ( https://github.com/addyosmani/timing.js ) .
19+ * [ time-method-call.js] ( time-method-call.js ) - measures single method call time.
1920* [ local-storage-size.js] ( local-storage-size.js ) - measures size of the strings in the ` localStorage ` .
2021* [ expensive-keys.js] ( expensive-keys.js ) - measures how much space individual keys and their values
2122take up in a collection of objects, read [ Measuring Space Allocation] [ measure ] .
Original file line number Diff line number Diff line change 1+ ( function profileMethodCall ( ) {
2+ var object = primesApp ;
3+ var methodName = 'findFirstPrimes' ;
4+ var originalMethod = object [ methodName ] ;
5+ console . assert ( typeof originalMethod === 'function' , 'cannot find method ' + methodName ) ;
6+ object [ methodName ] = function ( ) {
7+ console . time ( methodName ) ;
8+ originalMethod . call ( object ) ;
9+ console . timeEnd ( methodName ) ;
10+ // restore original methodName
11+ object [ methodName ] = originalMethod ;
12+ } ;
13+ } ( ) ) ;
You can’t perform that action at this time.
0 commit comments