Clone and build Node for analysis:
$ git clone https://github.com/joyent/node.git
$ cd node
$ export GYP_DEFINES="v8_enable_disassembler=1"
$ ./configure
$ make -j4
| var http = require('http'); | |
| var send = require('send'); | |
| var urlParse = require('url').parse; | |
| var count = 2; | |
| var server = http.createServer(function (req, res) { | |
| if (!--count) server.close(); // Only allow two connection and then exit. | |
| send(req, urlParse(req.url).pathname) | |
| .root(__dirname) | |
| .pipe(res); |
| # Description: | |
| # Display a random tweet from loudbot if someone YELLS in chat | |
| # | |
| # Dependencies: | |
| # "ntwitter" : "https://github.com/sebhildebrandt/ntwitter/tarball/master", | |
| # | |
| # Configuration: | |
| # HUBOT_TWITTER_CONSUMER_KEY | |
| # HUBOT_TWITTER_CONSUMER_SECRET | |
| # HUBOT_TWITTER_ACCESS_TOKEN_KEY |
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| #!/bin/bash | |
| FAIL=0 | |
| echo "starting" | |
| ./sleeper 2 0 & | |
| ./sleeper 2 1 & | |
| ./sleeper 3 0 & | |
| ./sleeper 2 0 & |