Skip to content

Instantly share code, notes, and snippets.

Created November 7, 2017 11:16
Show Gist options
  • Save anonymous/cb64256134fb6354ce8e0b94d4a2e490 to your computer and use it in GitHub Desktop.
Save anonymous/cb64256134fb6354ce8e0b94d4a2e490 to your computer and use it in GitHub Desktop.
var process_copy = Object.assign({}, process);
var process_ref = process;
process_copy.env = Object.assign({}, process.env);
var lab1 = 'normal process.env';
var lab2 = 'process copy env';
console.time(lab1);
var no_discard = false;
for(var i = 0; i < 1e7; i++) {
no_discard = no_discard || (process_ref.env.NODE_ENV == Math.random());
}
console.timeEnd(lab1);
console.time(lab2)
for(var i = 0; i < 1e7; i++) {
no_discard = no_discard || (process_copy.env.NODE_ENV == Math.random());
}
console.timeEnd(lab2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment