Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
MUR Drupal
d3-library
Commits
253631cb
Commit
253631cb
authored
Apr 05, 2014
by
Mike Bostock
Browse files
Run each benchmark separately.
parent
8b32c70d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
17 deletions
+7
-17
test/interpolate/interpolate-string-benchmark
test/interpolate/interpolate-string-benchmark
+7
-17
No files found.
test/interpolate/interpolate-string-benchmark
View file @
253631cb
...
...
@@ -2,7 +2,12 @@
var
d3
=
require
(
"
../../
"
);
var
formatNumber
=
d3
.
format
(
"
.3s
"
);
var
n
=
+
process
.
argv
[
2
],
p
=
+
process
.
argv
[
3
],
k
=
+
process
.
argv
[
4
];
var
formatTime
=
d3
.
format
(
"
.3s
"
),
formatNumber
=
d3
.
format
(
"
,.0f
"
);
// Returns the time required to construct a string interpolator
// for two strings with n numbers, separated by commas,
...
...
@@ -23,19 +28,4 @@ function observeConstruction(n, p, k) {
return
sum
/
k
;
}
console
.
log
(
formatNumber
(
observeConstruction
(
12000
,
0.00
,
40
))
+
"
s
\t
n=12,000
\t
p=0
"
);
console
.
log
(
formatNumber
(
observeConstruction
(
12000
,
0.50
,
40
))
+
"
s
\t
n=12,000
\t
p=.5
"
);
// console.log(formatNumber(observeConstruction( 12000, 0.93, 40)) + "s\tn=12,000\tp=.93");
console
.
log
(
formatNumber
(
observeConstruction
(
12000
,
1.00
,
40
))
+
"
s
\t
n=12,000
\t
p=1
"
);
console
.
log
(
formatNumber
(
observeConstruction
(
60000
,
0.00
,
20
))
+
"
s
\t
n=60,000
\t
p=0
"
);
console
.
log
(
formatNumber
(
observeConstruction
(
60000
,
0.50
,
20
))
+
"
s
\t
n=60,000
\t
p=.5
"
);
// console.log(formatNumber(observeConstruction( 60000, 0.93, 20)) + "s\tn=60,000\tp=.93");
console
.
log
(
formatNumber
(
observeConstruction
(
60000
,
1.00
,
20
))
+
"
s
\t
n=60,000
\t
p=1
"
);
console
.
log
(
formatNumber
(
observeConstruction
(
300000
,
0.00
,
10
))
+
"
s
\t
n=300,000
\t
p=0
"
);
console
.
log
(
formatNumber
(
observeConstruction
(
300000
,
0.50
,
10
))
+
"
s
\t
n=300,000
\t
p=.5
"
);
// console.log(formatNumber(observeConstruction( 300000, 0.93, 10)) + "s\tn=300,000\tp=.93");
console
.
log
(
formatNumber
(
observeConstruction
(
300000
,
1.00
,
10
))
+
"
s
\t
n=300,000
\t
p=1
"
);
console
.
log
(
formatNumber
(
observeConstruction
(
1500000
,
0.00
,
4
))
+
"
s
\t
n=1,500,000
\t
p=0
"
);
console
.
log
(
formatNumber
(
observeConstruction
(
1500000
,
0.50
,
4
))
+
"
s
\t
n=1,500,000
\t
p=.5
"
);
// console.log(formatNumber(observeConstruction(1500000, 0.93, 4)) + "s\tn=1,500,000\tp=.93");
console
.
log
(
formatNumber
(
observeConstruction
(
1500000
,
1.00
,
4
))
+
"
s
\t
n=1,500,000
\t
p=1
"
);
console
.
log
(
formatTime
(
observeConstruction
(
n
,
p
,
k
))
+
"
s
\t
n=
"
+
formatNumber
(
n
)
+
"
\t
p=
"
+
p
);
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