Skip to content

Instantly share code, notes, and snippets.

@goto-bus-stop
Last active August 22, 2018 13:12
Show Gist options
  • Save goto-bus-stop/a5d36e69c6d2db0679324911793ef92d to your computer and use it in GitHub Desktop.
Save goto-bus-stop/a5d36e69c6d2db0679324911793ef92d to your computer and use it in GitHub Desktop.
// npm install babel-register
// node collect | less
const { spawn } = require('child_process')
const sp = spawn('node', ['--print-opt-source', 'fib.js'], {stdio: ['ignore', 'pipe', 'inherit']})
sp.stdout.pipe(process.stdout)
const fibonacci = (num) => {
if (num <= 1) return 1;
// do something that will add a bunch more functions to be optimized
require('path').join('/', 'a')
return fibonacci(num - 1) + fibonacci(num - 2);
}
console.log(fibonacci(40))
@goto-bus-stop
Copy link
Author

--- FUNCTION SOURCE (path.js:normalizeString) id{0,-1} start{2047} ---
(path, allowAboveRoot, separator, isPathSeparator) {
  var res = '';
  var lastSegmentLength = 0;
  var lastSlash = -1;
  var dots = 0;
  var code;
  for (var i = 0; i <= path.length; ++i) {
    if (i < path.length)
      code = path.charCodeAt(i);
    else if (isPathSeparator(c--- FUNCTION SOURCE (path.js:isPosixPathSeparator) id{2,-1} start{1744} ---
(code) {
  return code === CHAR_FORWARD_SLASH;
}
--- END ---

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