Testing to see which one is faster
pre-increment wins... barely
var spawn = require('child_process').spawn; | |
function exec(args, callback) { | |
var out = '', | |
err = '', | |
child = spawn(args[0], args.slice(1)); | |
child.stdout.on('data', function(data) { | |
console.log('exec got stdout'+out); | |
out += data; |
Trace | |
at WriteStream.process.stdout.write (/Users/dave/dev/node-latest/index.js:4:11) | |
at Object.exports.log (console.js:25:18) | |
at Object.keys.forEach.console.(anonymous function) [as log] (/Users/dave/dev/node-latest/node_modules/log-timestamp/index.js:13:14) | |
at defaultCb (/Users/dave/dev/node-latest/node_modules/npm/lib/npm.js:205:16) | |
at Conf.done (/Users/dave/dev/node-latest/node_modules/npm/node_modules/npmconf/npmconf.js:218:15) | |
at Object.oncomplete (fs.js:297:15) | |
undefined | |
var a = 5, | |
count = 100 * 1000 * 1000; | |
for (var i = 0; i < count; i++) | |
String(a); |
$ echo 'http://www.daveeddy.com/some/path/here?name=dave' | urlparse | json query.name
dave
$ echo 'http://www.daveeddy.com/some/path/here?name=dave' | urlparse | json pathname
/some/path/here
$ echo 'http://www.daveeddy.com/some/path/here?name=dave' | urlparse
{
"protocol": "http:",
"slashes": true,
"host": "www.daveeddy.com",
# i suck and always forget this | |
block in from any to port = 80 | |
# more http://wiki.joyent.com/wiki/display/jpc2/Using+IPFilter+Rules |
run this to create m3u files for each free radio station that http://di.fm provides.
do this in a tempdir or something
egrep -o 'http://listen\.di\.fm/public3/.*\.pls' < <(curl -s http://www.di.fm/) | \
while read link; do
Testing performance from http://blog.csdn.net/undead/article/details/6447339
Compile and install the shared object libfasttime.c
Testing out libfasttime.so with redis-server on SmartOS. see https://gist.github.com/bahamas10/5493551 for info on libfasttime.so.
Benchmarking done with DTrace and redis-benchmark
from the redis source code
#!/usr/bin/env bash | |
# | |
# Simply create a flame graph and open it | |
# | |
# gen-flame.sh <trace file> [ filter ] | |
if [[ ! -f "$1" ]]; then | |
echo "Usage: ${0##*/} <trace file>" >&2 | |
exit 1 | |
fi |