Skip to content

Instantly share code, notes, and snippets.

@kriszyp
Forked from dvv/app.coffee
Created June 11, 2010 14:06
Show Gist options
  • Save kriszyp/434508 to your computer and use it in GitHub Desktop.
Save kriszyp/434508 to your computer and use it in GitHub Desktop.
var pinturaNodeApp = require("jsgi-node").Listener(pinturaApp);
run: () ->
http: require 'http'
server: http.createServer (request, response) ->
#sys.debug sys.inspect request
# separate handlers for high-load paths
if request.url is '/hello'
hello.call response
else if request.url is '/test'
redirector.call response, rnd()
else if request.url is '/install'
install.call response, rnd()
# delegate all the rest to pintura
else
pinturaNodeApp(request,response);
server.listen (settings.port or 80)
sys.puts 'Server running at http://127.0.0.1:' + (settings.port or 80)
@dvv
Copy link

dvv commented Jun 11, 2010

Requesting /hello from localhost via ab -c500 -n30000 -r http://127.0.0.1:8080:

Raw javascript:

Requests per second: 3435.09 #/sec

Express:

Requests per second: 2163.50 #/sec

Pintura:

  • routes just before function(request){return pinturaApp(request);}
    Requests per second: 1498.86 #/sec
  • routes just after require(jsgi-node).start(
    Requests per second: 3238.66 #/sec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment