Skip to content

Instantly share code, notes, and snippets.

@mattn
Last active February 3, 2023 02:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattn/7b76263fbc6ab618b93af028eb1d44d0 to your computer and use it in GitHub Desktop.
Save mattn/7b76263fbc6ab618b93af028eb1d44d0 to your computer and use it in GitHub Desktop.
$ ab -k -c 10 -n 10000 http://127.0.0.1:3000/

Node

Requests per second:    10137.73 [#/sec] (mean)

Go

Requests per second:    94338.73 [#/sec] (mean)
package main
import (
"fmt"
"net/http"
)
func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Content-Type", "text/html")
fmt.Fprintf(w, "<h1>Hello World</h1>")
})
http.ListenAndServe(":3000", nil)
}
const http = require("http");
const port = 3000;
const server = http.createServer((request, response) => {
response.writeHead(200, {
"Content-Type": "text/html"
});
const responseMessage = "<h1>Hello World</h1>";
response.end(responseMessage);
});
server.listen(port);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment