Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
69a5b23d
Commit
69a5b23d
authored
Feb 02, 2012
by
Brad Fitzpatrick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: make map nan timing test more robust
take 2 R=rsc CC=golang-dev
https://golang.org/cl/5617045
parent
e10150f9
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
2 deletions
+17
-2
map.go
test/map.go
+17
-2
No files found.
test/map.go
View file @
69a5b23d
...
@@ -667,10 +667,25 @@ func testnan() {
...
@@ -667,10 +667,25 @@ func testnan() {
return
time
.
Since
(
t0
)
return
time
.
Since
(
t0
)
}
}
n
:=
60000
// 0.04 seconds on a MacBook Air
// Depending on the machine and OS, this test might be too fast
// to measure with accurate enough granularity. On failure,
// make it run longer, hoping that the timing granularity
// is eventually sufficient.
n
:=
30000
// 0.02 seconds on a MacBook Air
fails
:=
0
for
{
t1
:=
t
(
n
)
t1
:=
t
(
n
)
t2
:=
t
(
2
*
n
)
t2
:=
t
(
2
*
n
)
if
t2
>
3
*
t1
{
// should be 2x (linear); allow up to 3x
// should be 2x (linear); allow up to 3x
if
t2
<
3
*
t1
{
return
}
fails
++
if
fails
==
4
{
fmt
.
Printf
(
"too slow: %d inserts: %v; %d inserts: %v
\n
"
,
n
,
t1
,
2
*
n
,
t2
)
fmt
.
Printf
(
"too slow: %d inserts: %v; %d inserts: %v
\n
"
,
n
,
t1
,
2
*
n
,
t2
)
return
}
n
*=
2
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment