esperantojs / esperanto

DEPRECATED: An easier way to convert ES6 modules to AMD and CommonJS
http://esperantojs.org
234 stars 21 forks source link

rudimentary profiling #138

Closed Rich-Harris closed 9 years ago

Rich-Harris commented 9 years ago

This probably isn't for merging, and it's an incomplete WIP, but I thought I'd put it here anyway. I wanted a half-decent way to measure where time is being spent, to see if anything is an obvious performance bottleneck. But it's crude, and the code is a bit crufty.

Anyway, some results from running npm test:

completed fastMode in 47ms
  parseTime: 6.9ms
  determineImportNames: 1.0ms
  analyse: 11.8ms
  packageResult: 0.1ms
  build: 5.6ms

completed strictMode in 179ms
  parseTime: 22.8ms
  annotateAst: 6.1ms
  determineImportNames: 2.2ms
  analyse: 43.0ms
  packageResult: 0.4ms
  build: 22.1ms

completed bundle in 640ms
  parseTime: 53.7ms
  analyse: 94.9ms
  combine: 76.3ms
  packageResult: 1.2ms
  build: 17.1ms

Some of these events are nested (e.g. parseTime is wholly contained by analyse - there are basically two phases, analyse and build). Time spend waiting for files to be read is currently ignored.