FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
atom/benchmarks/benchmark-runner.js at master · sbrinkerhoff/atom · GitHub
sbrinkerhoff
/
atom
Public
forked from
atom/atom
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
atom
/
benchmarks
/
benchmark-runner.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
75 lines (66 loc) · 2.25 KB
Breadcrumbs
atom
/
benchmarks
/
benchmark-runner.js
Copy path
File metadata and controls
75 lines (66 loc) · 2.25 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
const
Chart
=
require
(
'chart.js'
)
;
const
glob
=
require
(
'glob'
)
;
const
fs
=
require
(
'fs-plus'
)
;
const
path
=
require
(
'path'
)
;
module
.
exports
=
async
(
{
test
,
benchmarkPaths
}
)
=>
{
document
.
body
.
style
.
backgroundColor
=
'#ffffff'
;
document
.
body
.
style
.
overflow
=
'auto'
;
let
paths
=
[
]
;
for
(
const
benchmarkPath
of
benchmarkPaths
)
{
if
(
fs
.
isDirectorySync
(
benchmarkPath
)
)
{
paths
=
paths
.
concat
(
glob
.
sync
(
path
.
join
(
benchmarkPath
,
'**'
,
'*.bench.js'
)
)
)
;
}
else
{
paths
.
push
(
benchmarkPath
)
;
}
}
while
(
paths
.
length
>
0
)
{
const
benchmark
=
require
(
paths
.
shift
(
)
)
(
{
test
}
)
;
let
results
;
if
(
benchmark
instanceof
Promise
)
{
results
=
await
benchmark
;
}
else
{
results
=
benchmark
;
}
const
dataByBenchmarkName
=
{
}
;
for
(
const
{
name
,
duration
,
x
}
of
results
)
{
dataByBenchmarkName
[
name
]
=
dataByBenchmarkName
[
name
]
||
{
points
:
[
]
}
;
dataByBenchmarkName
[
name
]
.
points
.
push
(
{
x
,
y
:
duration
}
)
;
}
const
benchmarkContainer
=
document
.
createElement
(
'div'
)
;
document
.
body
.
appendChild
(
benchmarkContainer
)
;
for
(
const
key
in
dataByBenchmarkName
)
{
const
data
=
dataByBenchmarkName
[
key
]
;
if
(
data
.
points
.
length
>
1
)
{
const
canvas
=
document
.
createElement
(
'canvas'
)
;
benchmarkContainer
.
appendChild
(
canvas
)
;
// eslint-disable-next-line no-new
new
Chart
(
canvas
,
{
type
:
'line'
,
data
:
{
datasets
:
[
{
label
:
key
,
fill
:
false
,
data
:
data
.
points
}
]
}
,
options
:
{
showLines
:
false
,
scales
:
{
xAxes
:
[
{
type
:
'linear'
,
position
:
'bottom'
}
]
}
}
}
)
;
const
textualOutput
=
`
${
key
}
:\n\n`
+
data
.
points
.
map
(
p
=>
`
${
p
.
x
}
\t
${
p
.
y
}
`
)
.
join
(
'\n'
)
;
console
.
log
(
textualOutput
)
;
}
else
{
const
title
=
document
.
createElement
(
'h2'
)
;
title
.
textContent
=
key
;
benchmarkContainer
.
appendChild
(
title
)
;
const
duration
=
document
.
createElement
(
'p'
)
;
duration
.
textContent
=
`
${
data
.
points
[
0
]
.
y
}
ms`
;
benchmarkContainer
.
appendChild
(
duration
)
;
const
textualOutput
=
`
${
key
}
:
${
data
.
points
[
0
]
.
y
}
`
;
console
.
log
(
textualOutput
)
;
}
await
global
.
atom
.
reset
(
)
;
}
}
return
0
;
}
;
Back
|
FazBrowse Home
|
New Git URL