slipers

Lua. Node 5.4 vs Luvit 2.8 Benchmark.

Jun 6th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!

server.lua

local http = require('http')
http.createServer(function (req, res)
  local body = "Hello Worldn"
  res:setHeader("Content-Type", "text/plain")
  res:setHeader("Content-Length", #body)
  res:finish(body)
end):listen(5000, '127.0.0.1')
print('Server running at http://127.0.0.1:5000/')

server.js

const http = require('http');
const hostname = '127.0.0.1';
const port = 5001;
http.createServer((req, res) => {
  var body = 'Hello Worldn';
  res.writeHead(200, { 'Content-Type': 'text/plain', 'Content-Length': body.length });
  res.end(body);
}).listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`);
});

Results

Node: 29.79 Requests per Second (3549⁄119.15 sec)
luvit: 30.79 Requests per Second (3687⁄119.74 sec)

Add Comment
Please, Sign In to add comment