Example #1
0
func Sort(p uint) bool {
	n := uint64(1 << p)
	increasing := &Increasing{}
	funnelsort.NewItem = newItem
	funnelsort.FunnelSort(&Random{n}, increasing)
	return increasing.outOfOrder
}
Example #2
0
func Sort(r io.Reader, w TweetWriter) {
	runtime.GOMAXPROCS(runtime.NumCPU())

	funnelsort.NewItem = NewItem

	br := bufio.NewReaderSize(r, 1<<24)
	in := NewTweetReader(br)
	funnelsort.FunnelSort(in, w)
}
Example #3
0
func TestFunnelSort(t *testing.T) {
	n := uint64(1 << 14)
	increasing := &Increasing{}
	funnelsort.NewItem = newItem
	funnelsort.FunnelSort(&Random{n}, increasing)

	if increasing.outOfOrder {
		t.Error("output not sorted")
		t.FailNow()
	}
}