Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(68)

Side by Side Diff: test/maplinear.go

Issue 152570049: [dev.power64] code review 152570049: all: merge default into dev.power64 (Closed)
Patch Set: diff -r 36f7fc9495481ed67a159eea0eb2fac35b7c46a5 https://code.google.com/p/go Created 10 years, 4 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/live2.go ('k') | test/nosplit.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // +build darwin linux 1 // +build darwin linux
2 // run 2 // run
3 3
4 // Copyright 2013 The Go Authors. All rights reserved. 4 // Copyright 2013 The Go Authors. All rights reserved.
5 // Use of this source code is governed by a BSD-style 5 // Use of this source code is governed by a BSD-style
6 // license that can be found in the LICENSE file. 6 // license that can be found in the LICENSE file.
7 7
8 // Test that maps don't go quadratic for NaNs and other values. 8 // Test that maps don't go quadratic for NaNs and other values.
9 9
10 package main 10 package main
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 133 }
134 }) 134 })
135 135
136 // ~32ms on a 1.6GHz Zeon. 136 // ~32ms on a 1.6GHz Zeon.
137 checkLinear("complex128", 10000, func(n int) { 137 checkLinear("complex128", 10000, func(n int) {
138 m := map[complex128]int{} 138 m := map[complex128]int{}
139 for i := 0; i < n; i++ { 139 for i := 0; i < n; i++ {
140 m[complex(float64(i), float64(i))] = 1 140 m[complex(float64(i), float64(i))] = 1
141 } 141 }
142 }) 142 })
143
144 // ~70ms on a 1.6GHz Zeon.
145 // The iterate/delete idiom currently takes expected
146 // O(n lg n) time. Fortunately, the checkLinear test
147 // leaves enough wiggle room to include n lg n time
148 // (it actually tests for O(n^log_2(3)).
149 // To prevent false positives, average away variation
150 // by doing multiple rounds within a single run.
151 checkLinear("iterdelete", 2500, func(n int) {
152 for round := 0; round < 4; round++ {
153 m := map[int]int{}
154 for i := 0; i < n; i++ {
155 m[i] = i
156 }
157 for i := 0; i < n; i++ {
158 for k := range m {
159 delete(m, k)
160 break
161 }
162 }
163 }
164 })
143 } 165 }
OLDNEW
« no previous file with comments | « test/live2.go ('k') | test/nosplit.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b