Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building CoffeeScript at runtime is slow. #29

Closed
mweitzel opened this issue Sep 30, 2015 · 3 comments
Closed

Building CoffeeScript at runtime is slow. #29

mweitzel opened this issue Sep 30, 2015 · 3 comments
Assignees

Comments

@mweitzel
Copy link

Its impact is roughly 200ms per runtime.

For a baseline, in a file td-repro.js I have

console.log('hi')

when ran, it gives the output

$ time node td-repro.js
hi

real    0m0.107s
user    0m0.083s
sys 0m0.016s

after an npm install testdouble, I replace the contents of td-repro.js with

var td = require('testdouble');
var myTestDouble = td.create();

myTestDouble('foo', 5)
td.verify(myTestDouble('foo', 5))
console.log('success')

and run again, with these results:

$ time node td-repro.js
success

real    0m0.369s
user    0m0.371s
sys 0m0.035s

But, if I

  • comment out the first line of index.js (rather node_modules/testdouble/index.js)
  • and execute coffee -c node_modules/testdouble/lib/*.coffee node_modules/testdouble/lib/store/*.coffee~

then the times are way down:

$ time node td-repro.js
success

real    0m0.190s
user    0m0.164s
sys 0m0.026s

From a baseline of ~110ms per run, a library that adds 70-80ms per run is incredible compared to one that adds 250ms.

@searls
Copy link
Member

searls commented Sep 30, 2015

👍, I'd planned to switch to a prepublish step once the API settled down but having speed data makes it more urgent.

Hey @jasonkarns, I'm sure you'd prefer to own how we configure this in the build? Ideas?

On Sep 30, 2015, at 14:30, Matthew Weitzel notifications@github.com wrote:

Its impact is roughly 200ms per runtime.

For a baseline, in a file td-repro.js I have

console.log('hi')
when ran, it gives the output

$ time node td-repro.js
hi

real 0m0.107s
user 0m0.083s
sys 0m0.016s
after an npm install testdouble, I replace the contents of td-repro.js with

var td = require('testdouble');
var myTestDouble = td.create();

myTestDouble('foo', 5)
td.verify(myTestDouble('foo', 5))
console.log('success')
and run again, with these results:

$ time node td-repro.js
success

real 0m0.369s
user 0m0.371s
sys 0m0.035s
But, if I

comment out the first line of index.js (rather node_modules/testdouble/index.js)
and execute coffee -c node_modules/testdouble/lib/.coffee node_modules/testdouble/lib/store/.coffee~
then the times are way down:

$ time node td-repro.js
success

real 0m0.190s
user 0m0.164s
sys 0m0.026s
From a baseline of ~110ms per run, a library that adds 70-80ms per run is incredible compared to one that adds 250ms.


Reply to this email directly or view it on GitHub.

@jasonkarns
Copy link
Member

mostly:

  • prepublish to compile lib/.coffee to lib/.js
  • npm ignores *.coffee
  • git ignores *.js
  • remove coffee registration from index.js
  • add coffee registration to node-helper in tests
  • test suite points directly to lib/.coffee and not index.js (probably
    already does?)

On Wed, Sep 30, 2015 at 3:15 PM, Justin Searls notifications@github.com
wrote:

👍, I'd planned to switch to a prepublish step once the API settled down
but having speed data makes it more urgent.

Hey @jasonkarns, I'm sure you'd prefer to own how we configure this in the
build? Ideas?

On Sep 30, 2015, at 14:30, Matthew Weitzel notifications@github.com
wrote:

Its impact is roughly 200ms per runtime.

For a baseline, in a file td-repro.js I have

console.log('hi')
when ran, it gives the output

$ time node td-repro.js
hi

real 0m0.107s
user 0m0.083s
sys 0m0.016s
after an npm install testdouble, I replace the contents of td-repro.js
with

var td = require('testdouble');
var myTestDouble = td.create();

myTestDouble('foo', 5)
td.verify(myTestDouble('foo', 5))
console.log('success')
and run again, with these results:

$ time node td-repro.js
success

real 0m0.369s
user 0m0.371s
sys 0m0.035s
But, if I

comment out the first line of index.js (rather
node_modules/testdouble/index.js)
and execute coffee -c node_modules/testdouble/lib/.coffee
node_modules/testdouble/lib/store/
.coffee~
then the times are way down:

$ time node td-repro.js
success

real 0m0.190s
user 0m0.164s
sys 0m0.026s
From a baseline of ~110ms per run, a library that adds 70-80ms per run
is incredible compared to one that adds 250ms.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
#29 (comment)
.

@searls
Copy link
Member

searls commented Sep 30, 2015

Sounds good. Would you like to take a stab at this and assign yourself or
no?

On Wed, Sep 30, 2015 at 3:28 PM Jason Karns notifications@github.com
wrote:

mostly:

  • prepublish to compile lib/.coffee to lib/.js
  • npm ignores *.coffee
  • git ignores *.js
  • remove coffee registration from index.js
  • add coffee registration to node-helper in tests
  • test suite points directly to lib/.coffee and not index.js (probably
    already does?)

On Wed, Sep 30, 2015 at 3:15 PM, Justin Searls notifications@github.com
wrote:

👍, I'd planned to switch to a prepublish step once the API settled
down
but having speed data makes it more urgent.

Hey @jasonkarns, I'm sure you'd prefer to own how we configure this in
the
build? Ideas?

On Sep 30, 2015, at 14:30, Matthew Weitzel notifications@github.com
wrote:

Its impact is roughly 200ms per runtime.

For a baseline, in a file td-repro.js I have

console.log('hi')
when ran, it gives the output

$ time node td-repro.js
hi

real 0m0.107s
user 0m0.083s
sys 0m0.016s
after an npm install testdouble, I replace the contents of td-repro.js
with

var td = require('testdouble');
var myTestDouble = td.create();

myTestDouble('foo', 5)
td.verify(myTestDouble('foo', 5))
console.log('success')
and run again, with these results:

$ time node td-repro.js
success

real 0m0.369s
user 0m0.371s
sys 0m0.035s
But, if I

comment out the first line of index.js (rather
node_modules/testdouble/index.js)
and execute coffee -c node_modules/testdouble/lib/.coffee
node_modules/testdouble/lib/store/
.coffee~
then the times are way down:

$ time node td-repro.js
success

real 0m0.190s
user 0m0.164s
sys 0m0.026s
From a baseline of ~110ms per run, a library that adds 70-80ms per run
is incredible compared to one that adds 250ms.


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub
<
#29 (comment)

.


Reply to this email directly or view it on GitHub
#29 (comment)
.

@jasonkarns jasonkarns self-assigned this Sep 30, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants