@browserless/benchmark 10.2.5 → 10.9.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +0 -0
- package/package.json +16 -14
- package/src/index.js +10 -10
- package/src/screenshot/index.js +5 -4
- package/src/timing.js +2 -2
package/LICENSE.md
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@browserless/benchmark",
|
|
3
|
-
"description": "
|
|
3
|
+
"description": "Performance benchmarking tool for headless browser automation. Measure CPU, GPU, timing, and screenshot performance across configurations.",
|
|
4
4
|
"homepage": "https://browserless.js.org/#/?id=benchmark",
|
|
5
|
-
"version": "10.
|
|
5
|
+
"version": "10.9.18",
|
|
6
6
|
"main": "src/index.js",
|
|
7
7
|
"author": {
|
|
8
8
|
"email": "josefrancisco.verdu@gmail.com",
|
|
@@ -18,19 +18,20 @@
|
|
|
18
18
|
"url": "https://github.com/microlinkhq/browserless/issues"
|
|
19
19
|
},
|
|
20
20
|
"keywords": [
|
|
21
|
-
"bench",
|
|
22
|
-
"benchmark",
|
|
23
|
-
"browser",
|
|
24
21
|
"browserless",
|
|
25
|
-
"
|
|
26
|
-
"
|
|
22
|
+
"benchmark",
|
|
23
|
+
"performance",
|
|
27
24
|
"headless",
|
|
28
|
-
"
|
|
29
|
-
"puppeteer"
|
|
25
|
+
"chrome",
|
|
26
|
+
"puppeteer",
|
|
27
|
+
"profiling",
|
|
28
|
+
"cpu",
|
|
29
|
+
"gpu",
|
|
30
|
+
"metrics",
|
|
31
|
+
"optimization"
|
|
30
32
|
],
|
|
31
33
|
"devDependencies": {
|
|
32
34
|
"@kikobeats/time-span": "latest",
|
|
33
|
-
"@lukeed/ms": "latest",
|
|
34
35
|
"asciichart": "latest",
|
|
35
36
|
"browserless": "latest",
|
|
36
37
|
"debug-logfmt": "latest",
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
"p-all": "3",
|
|
41
42
|
"percentile": "latest",
|
|
42
43
|
"picocolors": "latest",
|
|
44
|
+
"pretty-ms": "7",
|
|
43
45
|
"process-stats": "latest",
|
|
44
46
|
"sieve-of-eratosthenes": "latest",
|
|
45
47
|
"term-img": "latest"
|
|
@@ -50,10 +52,10 @@
|
|
|
50
52
|
"files": [
|
|
51
53
|
"src"
|
|
52
54
|
],
|
|
53
|
-
"license": "MIT",
|
|
54
|
-
"gitHead": "d5f5d3bba991e4a2a3f88892e596414ce7a10688",
|
|
55
55
|
"scripts": {
|
|
56
56
|
"coverage": "exit 0",
|
|
57
57
|
"test": "exit 0"
|
|
58
|
-
}
|
|
59
|
-
|
|
58
|
+
},
|
|
59
|
+
"license": "MIT",
|
|
60
|
+
"gitHead": "f5e8cd0788e4bad3b3ad9b007943754f96653817"
|
|
61
|
+
}
|
package/src/index.js
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
const createBrowserless = require('browserless')
|
|
4
4
|
const processStats = require('process-stats')
|
|
5
|
-
const { format } = require('@lukeed/ms')
|
|
6
5
|
const asciichart = require('asciichart')
|
|
7
6
|
const { gray } = require('picocolors')
|
|
7
|
+
const prettyMs = require('pretty-ms')
|
|
8
8
|
const Measured = require('measured')
|
|
9
9
|
const pAll = require('p-all')
|
|
10
10
|
const meow = require('meow')
|
|
@@ -107,7 +107,7 @@ const benchmark = async ({
|
|
|
107
107
|
console.log(
|
|
108
108
|
` #${n < 10 ? `0${n}` : n} ${gray(
|
|
109
109
|
`cpu=${cpu.pretty} mem=${memUsed.pretty} eventLoop=${delay.pretty} time=`
|
|
110
|
-
)}${
|
|
110
|
+
)}${prettyMs(time)}`
|
|
111
111
|
)
|
|
112
112
|
return time
|
|
113
113
|
}
|
|
@@ -148,7 +148,7 @@ const main = async () => {
|
|
|
148
148
|
const graph = asciichart.plot(times, {
|
|
149
149
|
offset: 6,
|
|
150
150
|
height: 10,
|
|
151
|
-
format: time =>
|
|
151
|
+
format: time => prettyMs(time, { keepDecimalsOnWholeSeconds: true })
|
|
152
152
|
})
|
|
153
153
|
|
|
154
154
|
await strategy.onClose(browser)
|
|
@@ -161,13 +161,13 @@ const main = async () => {
|
|
|
161
161
|
${gray(' time:')} ${uptime.pretty}
|
|
162
162
|
${gray(' count:')} ${histogram.count}
|
|
163
163
|
${gray(' memUsed:')} ${memUsed.pretty}
|
|
164
|
-
${gray(' min:')} ${
|
|
165
|
-
${gray(' max:')} ${
|
|
166
|
-
${gray(' median:')} ${
|
|
167
|
-
${gray(' p75:')} ${
|
|
168
|
-
${gray(' p95:')} ${
|
|
169
|
-
${gray(' p99:')} ${
|
|
170
|
-
${gray(' p999:')} ${
|
|
164
|
+
${gray(' min:')} ${prettyMs(histogram.min)}
|
|
165
|
+
${gray(' max:')} ${prettyMs(histogram.max)}
|
|
166
|
+
${gray(' median:')} ${prettyMs(histogram.median)}
|
|
167
|
+
${gray(' p75:')} ${prettyMs(histogram.p75)}
|
|
168
|
+
${gray(' p95:')} ${prettyMs(histogram.p95)}
|
|
169
|
+
${gray(' p99:')} ${prettyMs(histogram.p99)}
|
|
170
|
+
${gray(' p999:')} ${prettyMs(histogram.p999)}`)
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
main().catch(error => console.error(error) || process.exit(1))
|
package/src/screenshot/index.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const timeSpan = require('@kikobeats/time-span')({ format: require('pretty-ms') })
|
|
4
4
|
const termImg = require('term-img')
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
const printImage = image =>
|
|
7
|
+
termImg(image, {
|
|
8
|
+
width: '50%'
|
|
9
|
+
})
|
|
9
10
|
|
|
10
11
|
const URLS = [
|
|
11
12
|
'https://example.com',
|
package/src/timing.js
CHANGED
|
@@ -4,7 +4,7 @@ const debug = require('debug-logfmt')('browserless:benchmark')
|
|
|
4
4
|
const timeSpan = require('@kikobeats/time-span')()
|
|
5
5
|
const createBrowser = require('browserless')
|
|
6
6
|
const percentile = require('percentile')
|
|
7
|
-
const
|
|
7
|
+
const prettyMs = require('pretty-ms')
|
|
8
8
|
|
|
9
9
|
const HEADLESS = true
|
|
10
10
|
// const TMP_FOLDER = '/tmp'
|
|
@@ -59,7 +59,7 @@ main(takeScreenshot, { iterations: 100, url: 'https://front-24ypc8or0.zeit.sh/'
|
|
|
59
59
|
.then(result => {
|
|
60
60
|
console.log()
|
|
61
61
|
Object.keys(result).forEach(key => {
|
|
62
|
-
console.log(` – ${key}: ${
|
|
62
|
+
console.log(` – ${key}: ${prettyMs(percentile(95, result[key]))}`)
|
|
63
63
|
})
|
|
64
64
|
})
|
|
65
65
|
.catch(error => console.error(error) || process.exit(1))
|