(Testing against trealla-go)
Previous version:
cpu: Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
BenchmarkQuery
BenchmarkQuery-16 1837 678403 ns/op
BenchmarkRedo
BenchmarkRedo-16 4272 287292 ns/op
| package trealla_test | |
| import ( | |
| "context" | |
| "sync/atomic" | |
| "testing" | |
| "sync" | |
| "github.com/trealla-prolog/go/trealla" |
(Testing against trealla-go)
Previous version:
cpu: Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
BenchmarkQuery
BenchmarkQuery-16 1837 678403 ns/op
BenchmarkRedo
BenchmarkRedo-16 4272 287292 ns/op
| package main | |
| import ( | |
| "bufio" | |
| "fmt" | |
| "os" | |
| "strings" | |
| ) | |
| type Room struct { |
| % caveat: add an extra line break to the input :-) | |
| :- use_module(library(dcgs)). | |
| :- use_module(library(pio)). | |
| elves([N|Ns]) --> elf(N), elves(Ns). | |
| elves([]) --> []. | |
| elf(Calories) --> sum(Calories), nl. | |
| sum(X) --> number(A), nl, sum(B), { X is A + B }. |
| package lib | |
| import ( | |
| "context" | |
| "math" | |
| "github.com/ichiban/prolog/engine" | |
| "github.com/guregu/predicates/internal" | |
| ) |
| package email | |
| import ( | |
| "github.com/aws/aws-sdk-go/aws" | |
| "github.com/aws/aws-sdk-go/aws/session" | |
| "github.com/aws/aws-sdk-go/service/ses" | |
| ) | |
| const noreply = " <[email protected]>" |
| package mail | |
| import ( | |
| "bytes" | |
| "encoding/json" | |
| "fmt" | |
| "net/http" | |
| ) | |
| var TelegramAuthToken string // set this |
| # Benchmarks for v4 | |
| BenchmarkIntUnmarshalJSON-8 4329932 268 ns/op 184 B/op 2 allocs/op | |
| BenchmarkIntStringUnmarshalJSON-8 4859449 248 ns/op 184 B/op 2 allocs/op | |
| BenchmarkNullIntUnmarshalJSON-8 183305532 6.46 ns/op 0 B/op 0 allocs/op | |
| BenchmarkStringUnmarshalJSON-8 4850442 241 ns/op 181 B/op 2 allocs/op | |
| BenchmarkNullStringUnmarshalJSON-8 184386210 6.46 ns/op 0 B/op 0 allocs/op | |
| # Benchmarks for v3 | |
| BenchmarkIntUnmarshalJSON-8 1756759 682 ns/op 392 B/op 6 allocs/op | |
| BenchmarkIntStringUnmarshalJSON-8 3163022 380 ns/op 216 B/op 4 allocs/op |
| function fixImageMaps(force) { | |
| var imgs = document.querySelectorAll("img[usemap]"); | |
| [].forEach.call(imgs, function(img) { | |
| if (!img.naturalHeight) { return; } | |
| var h = img.height / img.naturalHeight; | |
| var w = img.width / img.naturalWidth; | |
| var map = document.getElementsByName(img.useMap.slice(1))[0]; | |
| if (!map) { return; } | |
| for (var i = 0; i < map.children.length; i++) { | |
| var area = map.children[i]; |
| package main | |
| import ( | |
| "fmt" | |
| "net/http" | |
| "github.com/guregu/kami" | |
| "golang.org/x/net/context" | |
| ) |