From 36ca38a2a04e5ace8ef7c200d8bf9529f79742b2 Mon Sep 17 00:00:00 2001 From: Justin Lowery Date: Tue, 31 Oct 2017 12:15:29 -0400 Subject: [PATCH] Update README.md Change formatting for readability. --- README.md | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 81a773f..d077c89 100644 --- a/README.md +++ b/README.md @@ -53,12 +53,12 @@ func main() { iterCh, err := sm.BoundedIterCh(reversed, lowerBound, upperBound) if err != nil { fmt.Println(err) - } else { - defer iterCh.Close() + return + } + defer iterCh.Close() - for rec := range iterCh.Records() { - fmt.Printf("%+v\n", rec) - } + for rec := range iterCh.Records() { + fmt.Printf("%+v\n", rec) } } ``` @@ -68,8 +68,19 @@ Check out the [examples](https://github.com/umpc/go-sortedmap/tree/master/exampl ## Benchmarks ```sh +BenchmarkNew-8 20000000 98.8 ns/op 96 B/op 2 allocs/op + +BenchmarkHas1of1CachedRecords-8 50000000 27.3 ns/op 0 B/op 0 allocs/op +BenchmarkHas1of1Records-8 20000000 94.1 ns/op 0 B/op 0 allocs/op + +BenchmarkGet1of1CachedRecords-8 50000000 27.3 ns/op 0 B/op 0 allocs/op +BenchmarkGet1of1Records-8 20000000 96.8 ns/op 0 B/op 0 allocs/op + BenchmarkDelete1of1Records-8 5000000 285 ns/op 0 B/op 0 allocs/op +BenchmarkInsert1Record-8 3000000 442 ns/op 304 B/op 2 allocs/op +BenchmarkReplace1of1Records-8 5000000 378 ns/op 0 B/op 0 allocs/op + BenchmarkDelete1of10Records-8 2000000 615 ns/op 0 B/op 0 allocs/op BenchmarkDelete1of100Records-8 1000000 1005 ns/op 0 B/op 0 allocs/op BenchmarkDelete1of1000Records-8 1000000 1987 ns/op 0 B/op 0 allocs/op @@ -80,31 +91,21 @@ BenchmarkBatchDelete100of100Records-8 30000 47069 ns/op 112 BenchmarkBatchDelete1000of1000Records-8 2000 721201 ns/op 1024 B/op 1 allocs/op BenchmarkBatchDelete10000of10000Records-8 100 19275331 ns/op 10240 B/op 1 allocs/op -BenchmarkGet1of1CachedRecords-8 50000000 27.3 ns/op 0 B/op 0 allocs/op -BenchmarkGet1of1Records-8 20000000 96.8 ns/op 0 B/op 0 allocs/op - BenchmarkBatchGet10of10Records-8 2000000 902 ns/op 176 B/op 2 allocs/op BenchmarkBatchGet100of100Records-8 300000 5550 ns/op 1904 B/op 2 allocs/op BenchmarkBatchGet1000of1000Records-8 30000 49057 ns/op 17408 B/op 2 allocs/op BenchmarkBatchGet10000of10000Records-8 2000 710611 ns/op 174080 B/op 2 allocs/op -BenchmarkHas1of1CachedRecords-8 50000000 27.3 ns/op 0 B/op 0 allocs/op -BenchmarkHas1of1Records-8 20000000 94.1 ns/op 0 B/op 0 allocs/op - BenchmarkBatchHas10of10Records-8 2000000 742 ns/op 16 B/op 1 allocs/op BenchmarkBatchHas100of100Records-8 300000 5102 ns/op 112 B/op 1 allocs/op BenchmarkBatchHas1000of1000Records-8 30000 46257 ns/op 1024 B/op 1 allocs/op BenchmarkBatchHas10000of10000Records-8 3000 519497 ns/op 10240 B/op 1 allocs/op -BenchmarkInsert1Record-8 3000000 442 ns/op 304 B/op 2 allocs/op - BenchmarkBatchInsert10Records-8 300000 4164 ns/op 1382 B/op 8 allocs/op BenchmarkBatchInsert100Records-8 30000 54184 ns/op 14912 B/op 19 allocs/op BenchmarkBatchInsert1000Records-8 2000 844344 ns/op 201969 B/op 78 allocs/op BenchmarkBatchInsert10000Records-8 100 25911455 ns/op 2121554 B/op 584 allocs/op -BenchmarkReplace1of1Records-8 5000000 378 ns/op 0 B/op 0 allocs/op - BenchmarkReplace1of10Records-8 1000000 1021 ns/op 0 B/op 0 allocs/op BenchmarkReplace1of100Records-8 1000000 1669 ns/op 0 B/op 0 allocs/op BenchmarkReplace1of1000Records-8 500000 3187 ns/op 0 B/op 0 allocs/op @@ -114,8 +115,6 @@ BenchmarkBatchReplace10of10Records-8 200000 6934 ns/op 0 BenchmarkBatchReplace100of100Records-8 10000 100186 ns/op 0 B/op 0 allocs/op BenchmarkBatchReplace1000of1000Records-8 1000 1546355 ns/op 0 B/op 0 allocs/op BenchmarkBatchReplace10000of10000Records-8 20 58396360 ns/op 0 B/op 0 allocs/op - -BenchmarkNew-8 20000000 98.8 ns/op 96 B/op 2 allocs/op ``` The above benchmark tests were ran using a 4.0GHz Intel Core i7-4790K (Haswell) CPU.