Skip to content

Instantly share code, notes, and snippets.

@fhinkel
Forked from davidmarkclements/context-allocated-vars.js
Last active October 31, 2016 18:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fhinkel/adb226206d6bdcdbb045e85ad2ce33a3 to your computer and use it in GitHub Desktop.
Save fhinkel/adb226206d6bdcdbb045e85ad2ce33a3 to your computer and use it in GitHub Desktop.
function valuesFn (array) {
var i = 0
return function foo (abort, cb) {
if(i >= array.length)
cb(true)
else
cb(null, array[i++])
}
}
for( var a = 0; a < 100000; a++ ) {
valuesFn([], function() {})
}
@fhinkel
Copy link
Author

fhinkel commented Oct 31, 2016

$ node --trace-inlining index.js 
Did not inline valuesFn called from  (target has context-allocated variables).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment