use Date.now() instead of new Date() on responseTime middleware #878

Closed
wants to merge 1 commit into
from

Projects

None yet

2 participants

@fengmk2
fengmk2 commented Aug 27, 2013

Date.now() is 2X faster than new Date():

Date.now() x 8,889,858 ops/sec ±1.34% (94 runs sampled)
Date.now() - Date.now() x 4,379,721 ops/sec ±1.04% (92 runs sampled)
Date.now() - startNow x 7,886,918 ops/sec ±2.01% (96 runs sampled)
new Date() x 4,433,139 ops/sec ±1.99% (94 runs sampled)
new Date() - new Date() x 1,508,084 ops/sec ±2.27% (93 runs sampled)
new Date() - start x 2,169,245 ops/sec ±1.74% (90 runs sampled)
@tj
Member
tj commented Aug 27, 2013

all of those benchmarks just show that it really doesn't matter haha, anything in the millions (for web servers) really doesn't matter

@tj tj closed this Aug 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment