Permalink
Browse files

deleting project - everyone should use psilva261/timsort now

  • Loading branch information...
pgmmpk committed Oct 21, 2012
1 parent becc164 commit 4f002aaac49ad87abdd8c441db19a73e6da0c2ee
Showing with 2 additions and 275 deletions.
  1. +0 −4 .gitignore
  2. +2 −82 README.md
  3. +0 −189 bench_test.go
View
@@ -1,4 +0,0 @@
-/_obj
-/*.6
-/*.8
-.project
View
@@ -1,82 +1,2 @@
-# timsort
-
-**timsort** is a Go implementation of Tim Peters's mergesort
-sorting algorithm.
-
-For many input types it is 2-3 times faster than Go's built-in sorting.
-
-The main drawback of this sort method is that it is not in-place (as any
-mergesort), and may put extra strain on garbage collector.
-
-This implementation was derived from Java's TimSort object by Josh Bloch,
-which, in turn, was based on the [original code by Tim Peters][listsort]
-
-## Installation
-
-1. `git clone git://github.com/pgmmpk/timsort.git` to checkout the source
-2. `cd timsort`
-3. `make` builds all
-4. `make install` installs package
-
-Alternatively, you can install using `goinstall github.com/pgmmpk/timsort`, but
-if you do this, the import statement in your programs should be `import github.com/pgmmpk/timsort` instead of just `import timsort`.
-
-## Testing
-
-In source directory, say
-
- make test
-
-to run test harness
-
-## Benchmarking
-
-In source directory, say
-
- make bench
-
-to run benchmarks. Each combination of input type/size is presented to timsort,
-and, for comparison, to the standard Go sort (sort.Sort).
-See [BENCHMARKS.md][BENCHMARKS.md] for more info and some benchmarking results.
-
-## Example
-
- package main
-
- import (
- // depending on how timsort was installed, use the appropriate import target
- // "github.com/pgmmpk/timsort"
- "timsort"
- "fmt"
- )
-
- type Record struct {
- ssn int
- name string
- }
-
- func BySsn(a, b interface{}) bool {
- return a.(Record).ssn < b.(Record).ssn
- }
-
- func ByName(a, b interface{}) bool {
- return a.(Record).name < b.(Record).name
- }
-
- func main() {
- db := make([]interface{}, 3)
- db[0] = Record{123456789, "joe"}
- db[1] = Record{101765430, "sue"}
- db[2] = Record{345623452, "mary"}
-
- // sorts array by ssn (ascending)
- timsort.Sort(db, BySsn)
- fmt.Printf("sorted by ssn: %v\n", db)
-
- // now re-sort same array by name (ascending)
- timsort.Sort(db, ByName)
- fmt.Printf("sorted by name: %v\n", db)
- }
-
-[listsort]: http://svn.python.org/projects/python/trunk/Objects/listsort.txt
-[BENCHMARKS.md]: http://github.com/pgmmpk/timsort/blob/master/BENCHMARKS.md
+timsort has moved. New home for timsort is there:
+ https://github.com/psilva261/timsort
View
@@ -1,189 +0,0 @@
-package timsort
-
-import (
- "testing"
- "sort"
- "rand"
- // "fmt"
- "container/vector"
-)
-
-type record struct {
- key, order int
-}
-
-func (self *record) Less(o interface{}) bool {
- return self.key < o.(*record).key
-}
-
-func LessThanByKey(a, b interface{}) bool {
- return a.(*record).key < b.(*record).key
-}
-
-func LessThanByKeyByOrder(a, b interface{}) bool {
- aa := a.(*record)
- bb := b.(*record)
-
- if aa.key < bb.key {
- return true
- } else if aa.key == bb.key {
- return aa.order < bb.order
- }
-
- return false
-}
-
-func makeVector(size int, shape string) vector.Vector {
-
- var v vector.Vector
-
- switch shape {
-
- case "xor":
- for i := 0; i < size; i++ {
- v.Push(&record{0xff & (i ^ 0xab), i})
- }
-
- case "sorted":
- for i := 0; i < size; i++ {
- v.Push(&record{i, i})
- }
-
- case "revsorted":
- for i := 0; i < size; i++ {
- v.Push(&record{size - i, i})
- }
-
- case "random":
- rand.Seed(1)
-
- for i := 0; i < size; i++ {
- v.Push(&record{rand.Int(), i})
- }
-
- default:
- panic(shape)
- }
-
- return v
-}
-
-func benchmarkTimsort(b *testing.B, size int, shape string) {
- b.StopTimer()
-
- for j := 0; j < b.N; j++ {
- v := makeVector(size, shape)
-
- b.StartTimer()
- Sort(v, LessThanByKey)
- b.StopTimer()
- }
-}
-
-func benchmarkStandardSort(b *testing.B, size int, shape string) {
- b.StopTimer()
-
- for j := 0; j < b.N; j++ {
- v := makeVector(size, shape)
-
- b.StartTimer()
- sort.Sort(&v)
- b.StopTimer()
- }
-}
-
-func BenchmarkTimsortXor100(b *testing.B) {
- benchmarkTimsort(b, 100, "xor")
-}
-
-func BenchmarkStandardSortXor100(b *testing.B) {
- benchmarkStandardSort(b, 100, "xor")
-}
-
-func BenchmarkTimsortSorted100(b *testing.B) {
- benchmarkTimsort(b, 100, "sorted")
-}
-
-func BenchmarkStandardSortSorted100(b *testing.B) {
- benchmarkStandardSort(b, 100, "sorted")
-}
-
-func BenchmarkTimsortRevSorted100(b *testing.B) {
- benchmarkTimsort(b, 100, "revsorted")
-}
-
-func BenchmarkStandardSortRevSorted100(b *testing.B) {
- benchmarkStandardSort(b, 100, "revsorted")
-}
-
-func BenchmarkTimsortRandom100(b *testing.B) {
- benchmarkTimsort(b, 100, "random")
-}
-
-func BenchmarkStandardSortRandom100(b *testing.B) {
- benchmarkStandardSort(b, 100, "random")
-}
-
-func BenchmarkTimsortXor1K(b *testing.B) {
- benchmarkTimsort(b, 1024, "xor")
-}
-
-func BenchmarkStandardSortXor1K(b *testing.B) {
- benchmarkStandardSort(b, 1024, "xor")
-}
-
-func BenchmarkTimsortSorted1K(b *testing.B) {
- benchmarkTimsort(b, 1024, "sorted")
-}
-
-func BenchmarkStandardSortSorted1K(b *testing.B) {
- benchmarkStandardSort(b, 1024, "sorted")
-}
-
-func BenchmarkTimsortRevSorted1K(b *testing.B) {
- benchmarkTimsort(b, 1024, "revsorted")
-}
-
-func BenchmarkStandardSortRevSorted1K(b *testing.B) {
- benchmarkStandardSort(b, 1024, "revsorted")
-}
-
-func BenchmarkTimsortRandom1K(b *testing.B) {
- benchmarkTimsort(b, 1024, "random")
-}
-
-func BenchmarkStandardSortRandom1K(b *testing.B) {
- benchmarkStandardSort(b, 1024, "random")
-}
-
-func BenchmarkTimsortXor1M(b *testing.B) {
- benchmarkTimsort(b, 1024*1024, "xor")
-}
-
-func BenchmarkStandardSortXor1M(b *testing.B) {
- benchmarkStandardSort(b, 1024*1024, "xor")
-}
-
-func BenchmarkTimsortSorted1M(b *testing.B) {
- benchmarkTimsort(b, 1024*1024, "sorted")
-}
-
-func BenchmarkStandardSortSorted1M(b *testing.B) {
- benchmarkStandardSort(b, 1024*1024, "sorted")
-}
-
-func BenchmarkTimsortRevSorted1M(b *testing.B) {
- benchmarkTimsort(b, 1024*1024, "revsorted")
-}
-
-func BenchmarkStandardSortRevSorted1M(b *testing.B) {
- benchmarkStandardSort(b, 1024*1024, "revsorted")
-}
-
-func BenchmarkTimsortRandom1M(b *testing.B) {
- benchmarkTimsort(b, 1024*1024, "random")
-}
-
-func BenchmarkStandardSortRandom1M(b *testing.B) {
- benchmarkStandardSort(b, 1024*1024, "random")
-}

0 comments on commit 4f002aa

Please sign in to comment.