Compare:
import requests print(requests.get("http://localhost:3000").text)
package main import ( "fmt" "io" "net/http" ) func main() { resp, _ := http.Get("http://localhost:3000") defer resp.Body.Close() body, _ := io.ReadAll(resp.Body) fmt.Println(string(body)) }
python3: 0.08s user 0.02s system 91% cpu 0.113 total go 0.00s user 0.01s system 72% cpu 0.015 total
I wrote another that counts the lines in a file, and tested it against https://www.gutenberg.org/cache/epub/2600/pg2600.txt
I get:
python 0.03s user 0.01s system 83% cpu 0.059 total go 0.00s user 0.00s system 80% cpu 0.010 total
Compare:
to I get: (different hardware as I'm at home).I wrote another that counts the lines in a file, and tested it against https://www.gutenberg.org/cache/epub/2600/pg2600.txt
I get:
These are toy programs, but IME that these gaps stay as your programs get bigger