Open thejh opened 12 years ago
clarinets npm
test is 2.564s here, same thing in clarinobjects takes 3.497s.
WTF? @dscape How can my code be faster? Any idea why? I guess my implementation must be wrong or so...
[jann@Jann-PC node-clarinobjects master]$ time for i in {1..10}; do node test2.js > /dev/null; done
real 0m22.744s
user 0m22.454s
sys 0m0.498s
[jann@Jann-PC samples master]$ time for i in {1..10}; do node npm.js > /dev/null; done
real 0m24.841s
user 0m24.431s
sys 0m0.622s
So, for now, we're avoiding string concat costs by not doing it when we're already capturing. Makes stuff faster if we capture nearly everything anyway, but might be suboptimal in other cases.
dscape at new-host-2 in ~/Desktop/dev/node-clarinobjects on master*
$ time for i in {1..10}; do node node_modules/clarinet/samples/npm.js > /dev/null; done
real 0m14.913s
user 0m14.656s
sys 0m0.321s
dscape at new-host-2 in ~/Desktop/dev/node-clarinobjects on master*
$ time for i in {1..10}; do node test2.js > /dev/null; done
real 0m15.005s
user 0m14.752s
sys 0m0.323s
Two things learned:
1) Buy a new laptop :PP My macbook air runs circles around yours :) 2) Mine took about the same time, which I would expect :)
Let's talk more tomorrow when you (and me) are up!
Buy a new laptop :PP My macbook air runs circles around yours :)
Ouch... you mean, I should buy a new desktop PC? :D (or maybe it's just slow because it's in 32bit mode although it's a amd64 cpu?)
@dscape Which node version are you using? Or even better, post process.versions, v8 version probably is most interesting.
Here:
{ node: '0.6.7-pre',
v8: '3.6.6.14',
ares: '1.7.5-DEV',
uv: '0.6',
openssl: '1.0.0e-fips' }
{ node: '0.6.1',
v8: '3.6.6.7',
ares: '1.7.5-DEV',
uv: '0.1',
openssl: '0.9.8n' }
Doing string concatenation all the time might be very slow, check that.