Last active
January 4, 2016 06:49
-
-
Save joliss/8584850 to your computer and use it in GitHub Desktop.
This file contains 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
#!/bin/bash | |
set -e | |
( | |
echo -n -e '\xc3\x96' | |
dd if=/dev/zero bs=1048576 count=100 | |
) > big-file | |
echo | |
node -e " | |
var fs = require('fs') | |
console.time('Node read') | |
for (var i = 0; i < 1; i++) { | |
fs.readFileSync('big-file') | |
} | |
console.timeEnd('Node read') | |
console.time('Node read and decode') | |
for (i = 0; i < 1; i++) { | |
fs.readFileSync('big-file', { encoding: 'utf8' }) | |
} | |
console.timeEnd('Node read and decode') | |
" | |
echo -n 'Ruby read and decode: ' | |
ruby -e " | |
start = Time.now | |
File.read('big-file', encoding: 'utf-8') | |
puts '%ims' % ((Time.now - start) * 1000) | |
" | |
rm big-file |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment