Skip to content

Instantly share code, notes, and snippets.

Kevin Gillette extemporalgenome

Block or report user

Report or block extemporalgenome

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View gist:398f9a7a39d23641d14e
if [ $# -eq 0 ]; then
echo this script works when you run it without args
exit 0
# the parser only reaches this syntactically-invalid line if you pass the script args,
# proving that Bourne-compatible shells don't have separate parse and evaluate passes.
esac ] $(`)"
View main.go
package main
import "strconv"
func main() {
View results.txt
Tested on:
Linux 3.12-1-amd64 #1 SMP Debian 3.12.9-1 (2014-02-01) x86_64 GNU/Linux
[Dual Core] Intel(R) Atom(TM) CPU N450 @ 1.66GHz
(below output manually aligned)
Array#sort x 100,884 ops/sec ±1.54% (87 runs sampled)
mout/array/sort x 28,408 ops/sec ±1.98% (89 runs sampled)
nativeStableSort x 30,591 ops/sec ±4.26% (81 runs sampled)
nativeInPlaceStableSort x 66,010 ops/sec ±2.15% (97 runs sampled)
View copy_test.go
package main
import (
const N = 32 << 20 // 32 MiB
type struct32 struct {
extemporalgenome / 5-or-more-dups.txt
Last active Dec 17, 2015 table of basename duplicates (grouped by number of duplicates)
View 5-or-more-dups.txt
57 config
48 util
37 client
32 log
28 web
27 server
26 cache
25 model
23 core
23 redis
extemporalgenome / analyze.go
Last active Dec 11, 2015
Odd behavior of golang's sort.Sort implementation.
View analyze.go
package main
import (
func main() {
sortutil.Analyze(os.Stdout, true, sort.Sort)
View Benchmark
For whatever reason, at least with amd64 tests builds on my AMD X2 3800+,
the pointer receiver implementation is 13% slower when bound checks are elided.
# default run (value receiver is 49% slower than ptr receiver)
go test -bench .
BenchmarkSortVal 1000000 1300 ns/op
BenchmarkSortPtrToVal 1000000 1297 ns/op
BenchmarkSortPtr 2000000 870 ns/op
# no bounds checking (value receiver is 11% slower than ptr receiver)
View gist:2050048
def hex_buffer(buf):
retstr=''.join(map(lambda c:'\\x%02x'%ord(c),buf))
return retstr
View gist:2050041
def hex_buffer(buf):
retstr=''.join(map(lambda c:'\\x%02x'%ord(c),buf))
return retstr
You can’t perform that action at this time.