@browserless/benchmark 9.6.2 → 9.7.2

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/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@browserless/benchmark",
3
3
  "description": "Benchmarking tool for testing different browserless configurations",
4
4
  "homepage": "https://browserless.js.org/#/?id=benchmark",
5
- "version": "9.6.2",
5
+ "version": "9.7.2",
6
6
  "main": "src/index.js",
7
7
  "author": {
8
8
  "email": "josefrancisco.verdu@gmail.com",
@@ -57,5 +57,5 @@
57
57
  "test": "exit 0"
58
58
  },
59
59
  "license": "MIT",
60
- "gitHead": "e29ac9d5b86e7db27429130abc9689bbf39025dd"
60
+ "gitHead": "49eb374d4c0a2f735ae2a536d4e3d011abbed6a6"
61
61
  }
package/src/index.js CHANGED
@@ -58,9 +58,9 @@ const getStrategy = opts => {
58
58
  context: () => {
59
59
  return {
60
60
  onInit: () => createBrowserless(opts),
61
- onCreate: browserlessFactory => browserlessFactory.createContext(),
61
+ onCreate: browser => browser.createContext(),
62
62
  onDestroy: browserless => browserless.destroyContext(),
63
- onClose: browserlessFactory => browserlessFactory.close()
63
+ onClose: browser => browser.close()
64
64
  }
65
65
  },
66
66
  process: () => {
@@ -68,14 +68,14 @@ const getStrategy = opts => {
68
68
  return {
69
69
  onInit: () => {},
70
70
  onCreate: (_, n) => {
71
- const browserlessFactory = createBrowserless(opts)
72
- browsers.set(n, browserlessFactory)
73
- return browserlessFactory.createContext()
71
+ const browser = createBrowserless(opts)
72
+ browsers.set(n, browser)
73
+ return browser.createContext()
74
74
  },
75
75
  onDestroy: async (browserless, n) => {
76
- const browserlessFactory = browsers.get(n)
76
+ const browser = browsers.get(n)
77
77
  await browserless.destroyContext()
78
- return browserlessFactory.close()
78
+ return browser.close()
79
79
  },
80
80
  onClose: () => {}
81
81
  }
@@ -85,7 +85,7 @@ const getStrategy = opts => {
85
85
 
86
86
  const benchmark = async ({
87
87
  strategy,
88
- browserlessFactory,
88
+ browser,
89
89
  concurrency,
90
90
  getStats,
91
91
  iterations,
@@ -98,7 +98,7 @@ const benchmark = async ({
98
98
  return async () => {
99
99
  const stopwatch = timer.start()
100
100
 
101
- const browserless = await strategy.onCreate(browserlessFactory, n)
101
+ const browserless = await strategy.onCreate(browser, n)
102
102
  await browserless[method](url, opts)
103
103
  await strategy.onDestroy(browserless, n)
104
104
  const time = stopwatch.end()
@@ -131,12 +131,12 @@ const main = async () => {
131
131
 
132
132
  const strategy = getStrategy({ puppeteer, ...opts })[cli.flags.strategy]()
133
133
  const getStats = processStats()
134
- const browserlessFactory = strategy.onInit()
134
+ const browser = strategy.onInit()
135
135
 
136
136
  console.log()
137
137
  const { times, histogram } = await benchmark({
138
138
  strategy,
139
- browserlessFactory,
139
+ browser,
140
140
  concurrency,
141
141
  getStats,
142
142
  iterations,
@@ -151,7 +151,7 @@ const main = async () => {
151
151
  format: time => prettyMs(time, { keepDecimalsOnWholeSeconds: true })
152
152
  })
153
153
 
154
- await strategy.onClose(browserlessFactory)
154
+ await strategy.onClose(browser)
155
155
  const { uptime, memUsed } = getStats()
156
156
  getStats.destroy()
157
157
 
package/src/timing.js CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict'
2
2
 
3
- const browserlessFactory = require('browserless')
3
+ const createBrowser = require('browserless')
4
4
  const debug = require('debug-logfmt')('browserless:benchmark')
5
5
  const percentile = require('percentile')
6
6
  const timeSpan = require('time-span')
@@ -10,7 +10,7 @@ const HEADLESS = true
10
10
  // const TMP_FOLDER = '/tmp'
11
11
 
12
12
  const createBrowserless = id =>
13
- browserlessFactory({
13
+ createBrowser({
14
14
  headless: HEADLESS,
15
15
  lossyDeviceName: true,
16
16
  timeout: 15000
package/LICENSE.md DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright © 2019 Microlink <hello@microlink.io> (microlink.io)
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.