Created
July 6, 2012 20:20
-
-
Save gkz/3062563 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
say = -> process.stdout.write it + \\n | |
targets = | |
coco: \co | |
'coffee-script': \cf | |
'./lib/livescript': \ls | |
N = 99 | |
o = | |
# massive implicit call chain | |
call-chain: 'f f ' * N + \\n | |
# massive soak access chain | |
soak-access: 'o?.' * N + 'o\n' | |
# deep-nested blocks | |
blocks: '' | |
# deep-nested destructuring | |
destructuring: \[ * N + \x + \] * N + ' = a\n' | |
for i from 1 to N then o.blocks += "if #i\n" + ' ' * i | |
o.blocks += i + \\n | |
results = {} | |
left = 12 | |
for key, code of o | |
results[key] = {} | |
for name of targets | |
let co = require name | |
<-! process.nextTick | |
now = Date.now! | |
co.compile code | |
results[key][name] = Date.now! - now | |
if not --left | |
print-results! | |
function print-results | |
console.log '-----' | |
console.log "N = #N" | |
console.log '-----' | |
for name of targets | |
console.log "#name #{(require name)VERSION}" | |
console.log '-----\n' | |
results.total = {} | |
for key of o | |
for name of targets | |
results.total[name] ?= 0 | |
results.total[name] += results[key][name] | |
for key, type of results | |
console.log "# #key" | |
for name, abbr of targets | |
console.log "#abbr: #{results[key][name]}ms" | |
console.log "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment