Skip to content

Instantly share code, notes, and snippets.

View cstyan's full-sized avatar

Callum Styan cstyan

View GitHub Profile
benchmark old ns/op new ns/op delta
BenchmarkRangeQuery/expr=changes(a_hundred[1d]),steps=1000-8 2327329040 1599006600 -31.29%
BenchmarkRangeQuery/expr=changes(a_ten[1d]),steps=1000-8 234092823 162790996 -30.46%
BenchmarkRangeQuery/expr=changes(a_one[1d]),steps=1000-8 23363843 16257635 -30.42%
BenchmarkRangeQuery/expr=histogram_quantile(0.9,_rate(h_ten[5m])),steps=1000-8 45975941 64370106 +40.01%
BenchmarkRangeQuery/expr=changes(a_ten[1d]),steps=100-8 30085833 22510142 -25.18%
BenchmarkRangeQuery/expr=histogram_quantile(0.9,_rate(h_hundred[5m])),steps=1000-8
benchmark old ns/op new ns/op delta
BenchmarkRangeQuery/expr=histogram_quantile(0.9,_rate(h_ten[5m])),steps=1000-8 45566985 59345031 +30.24%
BenchmarkRangeQuery/expr=histogram_quantile(0.9,_rate(h_hundred[5m])),steps=1000-8 485158701 609517564 +25.63%
BenchmarkRangeQuery/expr=a_hundred_-_b_hundred,steps=1000-8 88261672 108532577 +22.97%
BenchmarkRangeQuery/expr=histogram_quantile(0.9,_rate(h_ten[5m])),steps=100-8 5847172 7187411 +22.92%
BenchmarkRangeQuery/expr=a_hundred_-_b_hundred,steps=10000-8 870485048 1068800679 +22.78%
BenchmarkRangeQuery/expr=a_ten_-_b_ten,steps=10000-8
benchmark old ns/op new ns/op delta
BenchmarkRangeQuery/expr=-a_hundred,steps=10-8 1274883 2060716 +61.64%
BenchmarkRangeQuery/expr=sum_without_(l)(rate(a_hundred[1m])),steps=10-8 2514173 1629128 -35.20%
BenchmarkRangeQuery/expr=sum_without_(l)(rate(a_hundred[1m])),steps=1-8 2251738 1488938 -33.88%
BenchmarkRangeQuery/expr=sum_without_(l)(rate(a_hundred[1m]))_/_sum_without_(l)(rate(b_hundred[1m])),steps=1-8 4850840 3218257 -33.66%
BenchmarkRangeQuery/expr=a_one_-_b_one,steps=1000-8 890324 1333926 +49.82%
BenchmarkRangeQuery/expr=sum_without_(l)(rate(a_hundred[1m]))_/_sum_without_(l)(rate(b_hun
@cstyan
cstyan / new
Created April 23, 2020 18:49
benchcmp master vs latest and master vs prev
benchcmp master vs latest commit
benchmark old ns/op new ns/op delta
BenchmarkRangeQuery/expr=a_ten_-_b_ten,steps=10000-8 80429636 130171151 +61.84%
BenchmarkRangeQuery/expr=a_ten_-_b_ten,steps=1000-8 8056329 12992590 +61.27%
BenchmarkRangeQuery/expr=changes(a_one[1d]),steps=1000-8 14778825 23694590 +60.33%
BenchmarkRangeQuery/expr=changes(a_ten[1d]),steps=1000-8 146776821 234601407 +59.84%
BenchmarkRangeQuery/expr=a_hundred_-_b_hundred,steps=10000-8 868686865 1372230788 +57.97%
BenchmarkRangeQuery/expr=changes(a_hundred[1d]),steps=10
@cstyan
cstyan / gist:d80b13d2c5e62447abbdcf3c6bb6417c
Created April 13, 2020 19:40
master vs promql hash changes
benchmark old ns/op new ns/op delta
BenchmarkRangeQuery/expr=a_one,steps=1-8 17062 17323 +1.53%
BenchmarkRangeQuery/expr=a_one,steps=10-8 17346 17343 -0.02%
BenchmarkRangeQuery/expr=a_one,steps=100-8 25523 25275 -0.97%
BenchmarkRangeQuery/expr=a_one,steps=1000-8 88703 89233 +0.60%
BenchmarkRangeQuery/expr=a_ten,steps=1-8 99073 99061 -0.01%
BenchmarkRangeQuery/expr=a_ten,steps=10-8
package main
import (
"errors"
"fmt"
"github.com/prometheus/tsdb/fileutil"
"os"
"sort"
"strconv"
#!/bin/bash
echo "<!doctype html><html lang=en><meta charset=utf-8><title>Networking Report</title>" > /tmp/networking_report.html
echo "about to report"
echo "<h1>Networking Report</h1>" >> /tmp/networking_report.html
echo "<p>using proxy: $PROXY_HOST:$PROXY_PORT" >> /tmp/networking_report.html
echo "<p>public networking: " >> /tmp/networking_report.html
curl -m 5 -sL -w "%{http_code} %{url_effective}\\n" "http://google.com" -o /dev/null >> /tmp/networking_report.html
echo "<p>proxied networking: " >> /tmp/networking_report.html
@cstyan
cstyan / panicExample.go
Created September 29, 2016 16:25
Example of how panic handlers work in Go, showing that you need to call a defer/recover function for each Go routine you want to handle panics in.
package main
import (
"fmt"
"math/rand"
"sync"
"time"
)
var waitGroup sync.WaitGroup