Skip to content

Instantly share code, notes, and snippets.

View jbowles's full-sized avatar
💭
working on it...

josh bowles jbowles

💭
working on it...
View GitHub Profile
@Komosa
Komosa / gheap.go
Last active November 7, 2015 11:38
Golang doesn't need neither runtime type-assertion nor code generation to provide generics
// this package is mostly copy-pasted from golang's std container/heap
// I changed Interface, Pop and Push in order to get rid of type assertions
// usage can be found in test file, benchmarks show that we can get about 27% of speedup for 1000 elems, or 10% for 10M elems (tested on go1.4)
package gheap
type Interface interface {
Len() int
Less(i, j int) bool
Swap(i, j int)
}