This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # $ python3 count_features.py writings/go-python-features.md | |
| # go1.25 0 23 | |
| # go1.24 1 29 | |
| # go1.23 15 27 | |
| # go1.22 6 41 | |
| # go1.21 8 50 | |
| # go1.20 4 33 | |
| # go1.19 0 14 | |
| # go1.18 15 31 | |
| # go1.17 3 15 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| | Go version | binary size (MB) | countwords (s) | sumloop (s) | | |
| | ---------- | ---------------- | -------------- | ----------- | | |
| | 1.0 | 3.27 | 8.20 | 9.47 | | |
| | 1.1 | 3.95 | 7.57 | 9.54 | | |
| | 1.2 | 5.50 | 25.51 | 9.36 | | |
| | 1.3 | 4.27 | 2.85 | 1.99 | | |
| | 1.4 | 4.32 | 3.03 | 2.13 | | |
| | 1.5 | 4.73 | 2.16 | 1.16 | | |
| | 1.6 | 4.70 | 2.15 | 1.18 | | |
| | 1.7 | 3.94 | 1.86 | 0.63 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import csv | |
| import os | |
| import subprocess | |
| import time | |
| print('| Go version | binary size (MB) | countwords (s) | sumloop (s) |') | |
| print('| ---------- | ---------------- | -------------- | ----------- |') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package model | |
| import ( | |
| "database/sql" | |
| "errors" | |
| "fmt" | |
| "reflect" | |
| "sync" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import collections, random, sys, textwrap | |
| # Build possibles table indexed by pair of prefix words (w1, w2) | |
| w1 = w2 = '' | |
| possibles = collections.defaultdict(list) | |
| for line in sys.stdin: | |
| for word in line.split(): | |
| possibles[w1, w2].append(word) | |
| w1, w2 = w2, word |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| "strconv" | |
| ) | |
| func main() { | |
| http.HandleFunc("/multiply", func(w http.ResponseWriter, r *http.Request) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| BEGIN { | |
| FS = "," | |
| } | |
| { | |
| nf = csvify(fields) | |
| for (i=1; i<=nf; i++) { | |
| printf "|%s|\n", fields[i] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "path/filepath" | |
| ) | |
| func main() { | |
| if len(os.Args) != 2 { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # NOTES | |
| "before" is Go version go1.19-dd97871282, before the switch jump tables commits | |
| "after" is Go version go1.19-78bea702cd, after the switch jump tables commits | |
| # GOAWK'S GO MICROBENCHMARKS | |
| $ benchstat -sort=delta -geomean benchmarks_before.txt benchmarks_after.txt | |
| name old time/op new time/op delta | |
| IncrDecr-8 141ns ± 1% 160ns ± 2% +13.59% (p=0.008 n=5+5) | |
| IfStatement-8 147ns ± 1% 157ns ± 2% +6.59% (p=0.008 n=5+5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static void* prog[] = { | |
| - // loop: | |
| &&i_pushvar0, // pushvar i | |
| &&i_pushnum, (void*)100000000, // pushnum 100000000 | |
| &&i_jge, (void*)5, // jge end | |
| + // loop: | |
| &&i_pushvar0, // push i | |
| &&i_addvar1, // addvar s | |
| &&i_incvar0, // incvar i | |
| - &&i_jmp, (void*)((long long)-10), // jmp loop |
NewerOlder