mirror of
https://github.com/ianstormtaylor/slate.git
synced 2025-09-02 11:42:53 +02:00
Fix benchmarks that use value.change (#2569)
* benchmark for large with selection * inputer -> inputter * value.change -> editor for slate benchmarks * use editor in slate-react benchmarks * prettier * fix decorations benchmark
This commit is contained in:
@@ -29,7 +29,7 @@ module.exports.run = function(include) {
|
|||||||
const dir = resolve(benchmarkDir, benchmark)
|
const dir = resolve(benchmarkDir, benchmark)
|
||||||
const module = require(dir)
|
const module = require(dir)
|
||||||
const fn = module.default
|
const fn = module.default
|
||||||
bench.input(() => module.input)
|
bench.input(module.input)
|
||||||
|
|
||||||
bench.run(input => {
|
bench.run(input => {
|
||||||
fn(input)
|
fn(input)
|
||||||
|
@@ -4,14 +4,15 @@
|
|||||||
const React = require('react')
|
const React = require('react')
|
||||||
const ReactDOM = require('react-dom/server')
|
const ReactDOM = require('react-dom/server')
|
||||||
const h = require('../../helpers/h')
|
const h = require('../../helpers/h')
|
||||||
const { Editor } = require('slate-react')
|
const { Editor } = require('slate')
|
||||||
|
const { Editor: EditorComponent } = require('slate-react')
|
||||||
|
|
||||||
module.exports.default = function(value) {
|
module.exports.default = function(value) {
|
||||||
const el = React.createElement(Editor, { value })
|
const el = React.createElement(EditorComponent, { value })
|
||||||
ReactDOM.renderToStaticMarkup(el)
|
ReactDOM.renderToStaticMarkup(el)
|
||||||
}
|
}
|
||||||
|
|
||||||
const value = (
|
let value = (
|
||||||
<value>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
@@ -49,4 +50,8 @@ const decorations = texts.flatMap((t, index) => {
|
|||||||
]
|
]
|
||||||
})
|
})
|
||||||
|
|
||||||
module.exports.input = value.change().setValue({ decorations }).value
|
value = value.setProperties({ decorations })
|
||||||
|
|
||||||
|
const editor = new Editor({ value })
|
||||||
|
|
||||||
|
module.exports.input = editor.value
|
||||||
|
66
benchmark/slate-react/rendering/large-with-selection.js
Normal file
66
benchmark/slate-react/rendering/large-with-selection.js
Normal file
@@ -0,0 +1,66 @@
|
|||||||
|
/** @jsx h */
|
||||||
|
/* eslint-disable react/jsx-key */
|
||||||
|
|
||||||
|
const React = require('react')
|
||||||
|
const ReactDOM = require('react-dom/server')
|
||||||
|
const h = require('../../helpers/h')
|
||||||
|
const { Editor } = require('slate-react')
|
||||||
|
|
||||||
|
module.exports.default = function(value) {
|
||||||
|
const el = React.createElement(Editor, { value })
|
||||||
|
ReactDOM.renderToStaticMarkup(el)
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports.input = (
|
||||||
|
<value>
|
||||||
|
<document>
|
||||||
|
<paragraph>
|
||||||
|
Breve whipped ristretto ut as to go café au lait. Extra, skinny
|
||||||
|
trifecta, cup chicory medium cup dripper whipped coffee cultivar. Body
|
||||||
|
crema iced whipped, grounds turkish coffee steamed crema affogato.{' '}
|
||||||
|
<b>Skinny that wings aged cream,</b> grounds siphon coffee french press
|
||||||
|
mazagran irish roast.
|
||||||
|
</paragraph>
|
||||||
|
<block type="level-one">
|
||||||
|
<block type="level-two">
|
||||||
|
<block type="coffee-container">
|
||||||
|
<inline type="coffee">
|
||||||
|
Extra, brewed caffeine fair trade, whipped cup bar flavour grounds
|
||||||
|
organic. Café au lait blue mountain cortado saucer, macchiato ut
|
||||||
|
that caramelization flavour.
|
||||||
|
</inline>
|
||||||
|
<inline type="coffee">
|
||||||
|
Crema frappuccino so decaffeinated, sit café au lait irish
|
||||||
|
cultivar doppio café au lait. Dripper irish fair trade <anchor />kopi-luwak
|
||||||
|
ut beans skinny saucer.
|
||||||
|
</inline>
|
||||||
|
</block>
|
||||||
|
<block type="coffee-container">
|
||||||
|
<inline type="coffee">
|
||||||
|
Half and half, irish rich sugar medium frappuccino spoon. Whipped,
|
||||||
|
caramelization, caffeine french press cinnamon variety rich redeye
|
||||||
|
acerbic americano aftertaste. Shop crema filter seasonal, filter
|
||||||
|
aromatic, french press mazagran affogato cappuccino single origin.
|
||||||
|
</inline>
|
||||||
|
Plunger pot aromatic, crema, cultivar french press, skinny and
|
||||||
|
percolator so single origin. Id variety and cinnamon brewed flavour
|
||||||
|
cultivar acerbic half and half et<focus /> cappuccino.
|
||||||
|
<inline type="coffee">
|
||||||
|
Cup qui a barista crema white kopi-luwak chicory trifecta.
|
||||||
|
</inline>
|
||||||
|
</block>
|
||||||
|
</block>
|
||||||
|
</block>
|
||||||
|
{Array.from(Array(10)).map(() => (
|
||||||
|
<quote>
|
||||||
|
<paragraph>
|
||||||
|
<paragraph>
|
||||||
|
This is editable <b>rich</b> text, <i>much</i> better than a
|
||||||
|
textarea!
|
||||||
|
</paragraph>
|
||||||
|
</paragraph>
|
||||||
|
</quote>
|
||||||
|
))}
|
||||||
|
</document>
|
||||||
|
</value>
|
||||||
|
)
|
@@ -2,9 +2,10 @@
|
|||||||
/* eslint-disable react/jsx-key */
|
/* eslint-disable react/jsx-key */
|
||||||
|
|
||||||
const h = require('../../helpers/h')
|
const h = require('../../helpers/h')
|
||||||
|
const { Editor } = require('slate')
|
||||||
|
|
||||||
module.exports.default = function(change) {
|
module.exports.default = function(editor) {
|
||||||
change
|
editor
|
||||||
.addMark('bold')
|
.addMark('bold')
|
||||||
.moveForward(5)
|
.moveForward(5)
|
||||||
.addMark('bold')
|
.addMark('bold')
|
||||||
@@ -37,6 +38,6 @@ const value = (
|
|||||||
</value>
|
</value>
|
||||||
)
|
)
|
||||||
|
|
||||||
module.exports.input = function() {
|
module.exports.input = () => {
|
||||||
return value.change()
|
return new Editor({ value })
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,10 @@
|
|||||||
/* eslint-disable react/jsx-key */
|
/* eslint-disable react/jsx-key */
|
||||||
|
|
||||||
const h = require('../../helpers/h')
|
const h = require('../../helpers/h')
|
||||||
|
const { Editor } = require('slate')
|
||||||
|
|
||||||
module.exports.default = function(change) {
|
module.exports.default = function(editor) {
|
||||||
change
|
editor
|
||||||
.deleteBackward()
|
.deleteBackward()
|
||||||
.deleteBackward()
|
.deleteBackward()
|
||||||
.deleteBackward()
|
.deleteBackward()
|
||||||
@@ -31,5 +32,5 @@ const value = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
module.exports.input = () => {
|
module.exports.input = () => {
|
||||||
return value.change()
|
return new Editor({ value })
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,10 @@
|
|||||||
/* eslint-disable react/jsx-key */
|
/* eslint-disable react/jsx-key */
|
||||||
|
|
||||||
const h = require('../../helpers/h')
|
const h = require('../../helpers/h')
|
||||||
|
const { Editor } = require('slate')
|
||||||
|
|
||||||
module.exports.default = function(change) {
|
module.exports.default = function(editor) {
|
||||||
change
|
editor
|
||||||
.deleteForward()
|
.deleteForward()
|
||||||
.deleteForward()
|
.deleteForward()
|
||||||
.deleteForward()
|
.deleteForward()
|
||||||
@@ -31,5 +32,5 @@ const value = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
module.exports.input = () => {
|
module.exports.input = () => {
|
||||||
return value.change()
|
return new Editor({ value })
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,10 @@
|
|||||||
/* eslint-disable react/jsx-key */
|
/* eslint-disable react/jsx-key */
|
||||||
|
|
||||||
const h = require('../../helpers/h')
|
const h = require('../../helpers/h')
|
||||||
|
const { Editor } = require('slate')
|
||||||
|
|
||||||
module.exports.default = function(change) {
|
module.exports.default = function(editor) {
|
||||||
change
|
editor
|
||||||
.insertNodeByKey('a0', 0, <paragraph>Hello world</paragraph>)
|
.insertNodeByKey('a0', 0, <paragraph>Hello world</paragraph>)
|
||||||
.insertNodeByKey('a1', 1, <paragraph>Hello world</paragraph>)
|
.insertNodeByKey('a1', 1, <paragraph>Hello world</paragraph>)
|
||||||
.insertNodeByKey('a2', 2, <paragraph>Hello world</paragraph>)
|
.insertNodeByKey('a2', 2, <paragraph>Hello world</paragraph>)
|
||||||
@@ -29,5 +30,5 @@ const value = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
module.exports.input = function() {
|
module.exports.input = function() {
|
||||||
return value.change()
|
return new Editor({ value })
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,10 @@
|
|||||||
/* eslint-disable react/jsx-key */
|
/* eslint-disable react/jsx-key */
|
||||||
|
|
||||||
const h = require('../../helpers/h')
|
const h = require('../../helpers/h')
|
||||||
|
const { Editor } = require('slate')
|
||||||
|
|
||||||
module.exports.default = function({ change, text }) {
|
module.exports.default = function(editor) {
|
||||||
change
|
editor
|
||||||
.insertTextByKey('T1', 0, 'one')
|
.insertTextByKey('T1', 0, 'one')
|
||||||
.insertTextByKey('T2', 5, 'two')
|
.insertTextByKey('T2', 5, 'two')
|
||||||
.insertTextByKey('T3', 10, 'three')
|
.insertTextByKey('T3', 10, 'three')
|
||||||
@@ -31,9 +32,8 @@ const value = (
|
|||||||
</document>
|
</document>
|
||||||
</value>
|
</value>
|
||||||
)
|
)
|
||||||
const text = value.document.getLastText()
|
// const text = value.document.getLastText()
|
||||||
|
|
||||||
module.exports.input = function() {
|
module.exports.input = () => {
|
||||||
const change = value.change()
|
return new Editor({ value })
|
||||||
return { change, text }
|
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,10 @@
|
|||||||
/* eslint-disable react/jsx-key */
|
/* eslint-disable react/jsx-key */
|
||||||
|
|
||||||
const h = require('../../helpers/h')
|
const h = require('../../helpers/h')
|
||||||
|
const { Editor } = require('slate')
|
||||||
|
|
||||||
module.exports.default = function(change) {
|
module.exports.default = function(editor) {
|
||||||
change
|
editor
|
||||||
.insertText('one')
|
.insertText('one')
|
||||||
.moveForward(5)
|
.moveForward(5)
|
||||||
.insertText('two')
|
.insertText('two')
|
||||||
@@ -34,6 +35,6 @@ const value = (
|
|||||||
</value>
|
</value>
|
||||||
)
|
)
|
||||||
|
|
||||||
module.exports.input = function() {
|
module.exports.input = () => {
|
||||||
return value.change()
|
return new Editor({ value })
|
||||||
}
|
}
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
/* eslint-disable react/jsx-key */
|
/* eslint-disable react/jsx-key */
|
||||||
|
|
||||||
const h = require('../../helpers/h')
|
const h = require('../../helpers/h')
|
||||||
|
const { Editor } = require('slate')
|
||||||
|
|
||||||
module.exports.default = function(change) {
|
module.exports.default = function(change) {
|
||||||
change
|
change
|
||||||
@@ -35,5 +36,5 @@ const value = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
module.exports.input = function() {
|
module.exports.input = function() {
|
||||||
return value.change()
|
return new Editor({ value }, { normalize: false })
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,10 @@
|
|||||||
/* eslint-disable react/jsx-key */
|
/* eslint-disable react/jsx-key */
|
||||||
|
|
||||||
const h = require('../../helpers/h')
|
const h = require('../../helpers/h')
|
||||||
|
const { Editor } = require('slate')
|
||||||
|
|
||||||
module.exports.default = function({ change, text }) {
|
module.exports.default = function(editor) {
|
||||||
change
|
editor
|
||||||
.removeNodeByKey('T1')
|
.removeNodeByKey('T1')
|
||||||
.removeNodeByKey('T2')
|
.removeNodeByKey('T2')
|
||||||
.removeNodeByKey('T3')
|
.removeNodeByKey('T3')
|
||||||
@@ -34,6 +35,5 @@ const value = (
|
|||||||
const text = value.document.getLastText()
|
const text = value.document.getLastText()
|
||||||
|
|
||||||
module.exports.input = function() {
|
module.exports.input = function() {
|
||||||
const change = value.change()
|
return new Editor({ value })
|
||||||
return { change, text }
|
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,10 @@
|
|||||||
/* eslint-disable react/jsx-key */
|
/* eslint-disable react/jsx-key */
|
||||||
|
|
||||||
const h = require('../../helpers/h')
|
const h = require('../../helpers/h')
|
||||||
|
const { Editor } = require('slate')
|
||||||
|
|
||||||
module.exports.default = function(change) {
|
module.exports.default = function(editor) {
|
||||||
change
|
editor
|
||||||
.setBlocks('quote')
|
.setBlocks('quote')
|
||||||
.setBlocks('paragraph')
|
.setBlocks('paragraph')
|
||||||
.setBlocks('aside')
|
.setBlocks('aside')
|
||||||
@@ -31,5 +32,5 @@ const value = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
module.exports.input = function() {
|
module.exports.input = function() {
|
||||||
return value.change()
|
return new Editor({ value })
|
||||||
}
|
}
|
||||||
|
@@ -2,9 +2,10 @@
|
|||||||
/* eslint-disable react/jsx-key */
|
/* eslint-disable react/jsx-key */
|
||||||
|
|
||||||
const h = require('../../helpers/h')
|
const h = require('../../helpers/h')
|
||||||
|
const { Editor } = require('slate')
|
||||||
|
|
||||||
module.exports.default = function(change) {
|
module.exports.default = function(editor) {
|
||||||
change
|
editor
|
||||||
.splitBlock()
|
.splitBlock()
|
||||||
.moveForward(5)
|
.moveForward(5)
|
||||||
.splitBlock()
|
.splitBlock()
|
||||||
@@ -35,5 +36,5 @@ const value = (
|
|||||||
)
|
)
|
||||||
|
|
||||||
module.exports.input = function() {
|
module.exports.input = function() {
|
||||||
return value.change()
|
return new Editor({ value })
|
||||||
}
|
}
|
||||||
|
@@ -2,12 +2,13 @@
|
|||||||
/* eslint-disable react/jsx-key */
|
/* eslint-disable react/jsx-key */
|
||||||
|
|
||||||
const h = require('../../helpers/h')
|
const h = require('../../helpers/h')
|
||||||
|
const { Editor } = require('slate')
|
||||||
|
|
||||||
module.exports.default = function(value) {
|
module.exports.default = function(value) {
|
||||||
value.document.getActiveMarksAtRange(value.selection)
|
value.document.getActiveMarksAtRange(value.selection)
|
||||||
}
|
}
|
||||||
|
|
||||||
const value = (
|
let value = (
|
||||||
<value>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
@@ -23,8 +24,12 @@ const value = (
|
|||||||
</document>
|
</document>
|
||||||
</value>
|
</value>
|
||||||
)
|
)
|
||||||
.change()
|
|
||||||
.moveToRangeOfDocument().value
|
const editor = new Editor({ value })
|
||||||
|
|
||||||
|
editor.moveToRangeOfDocument()
|
||||||
|
|
||||||
|
value = editor.value
|
||||||
|
|
||||||
module.exports.input = function() {
|
module.exports.input = function() {
|
||||||
return value
|
return value
|
||||||
|
@@ -2,12 +2,13 @@
|
|||||||
/* eslint-disable react/jsx-key */
|
/* eslint-disable react/jsx-key */
|
||||||
|
|
||||||
const h = require('../../helpers/h')
|
const h = require('../../helpers/h')
|
||||||
|
const { Editor } = require('slate')
|
||||||
|
|
||||||
module.exports.default = function(value) {
|
module.exports.default = function(value) {
|
||||||
value.document.getLeafBlocksAtRange(value.selection)
|
value.document.getLeafBlocksAtRange(value.selection)
|
||||||
}
|
}
|
||||||
|
|
||||||
const value = (
|
let value = (
|
||||||
<value>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
@@ -23,8 +24,10 @@ const value = (
|
|||||||
</document>
|
</document>
|
||||||
</value>
|
</value>
|
||||||
)
|
)
|
||||||
.change()
|
|
||||||
.moveToRangeOfDocument().value
|
const editor = new Editor({ value })
|
||||||
|
editor.moveToRangeOfDocument()
|
||||||
|
value = editor.value
|
||||||
|
|
||||||
module.exports.input = () => {
|
module.exports.input = () => {
|
||||||
return value
|
return value
|
||||||
|
@@ -2,12 +2,13 @@
|
|||||||
/* eslint-disable react/jsx-key */
|
/* eslint-disable react/jsx-key */
|
||||||
|
|
||||||
const h = require('../../helpers/h')
|
const h = require('../../helpers/h')
|
||||||
|
const { Editor } = require('slate')
|
||||||
|
|
||||||
module.exports.default = function(value) {
|
module.exports.default = function(value) {
|
||||||
value.document.getLeafInlinesAtRange(value.selection)
|
value.document.getLeafInlinesAtRange(value.selection)
|
||||||
}
|
}
|
||||||
|
|
||||||
const value = (
|
let value = (
|
||||||
<value>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
@@ -23,8 +24,10 @@ const value = (
|
|||||||
</document>
|
</document>
|
||||||
</value>
|
</value>
|
||||||
)
|
)
|
||||||
.change()
|
|
||||||
.moveToRangeOfDocument().value
|
const editor = new Editor({ value })
|
||||||
|
editor.moveToRangeOfDocument()
|
||||||
|
value = editor.value
|
||||||
|
|
||||||
module.exports.input = function() {
|
module.exports.input = function() {
|
||||||
return value
|
return value
|
||||||
|
@@ -2,12 +2,13 @@
|
|||||||
/* eslint-disable react/jsx-key */
|
/* eslint-disable react/jsx-key */
|
||||||
|
|
||||||
const h = require('../../helpers/h')
|
const h = require('../../helpers/h')
|
||||||
|
const { Editor } = require('slate')
|
||||||
|
|
||||||
module.exports.default = function(value) {
|
module.exports.default = function(value) {
|
||||||
value.document.getMarksAtRange(value.selection)
|
value.document.getMarksAtRange(value.selection)
|
||||||
}
|
}
|
||||||
|
|
||||||
const value = (
|
let value = (
|
||||||
<value>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
@@ -23,8 +24,10 @@ const value = (
|
|||||||
</document>
|
</document>
|
||||||
</value>
|
</value>
|
||||||
)
|
)
|
||||||
.change()
|
|
||||||
.moveToRangeOfDocument().value
|
const editor = new Editor({ value })
|
||||||
|
editor.moveToRangeOfDocument()
|
||||||
|
value = editor.value
|
||||||
|
|
||||||
module.exports.input = function() {
|
module.exports.input = function() {
|
||||||
return value
|
return value
|
||||||
|
@@ -2,12 +2,13 @@
|
|||||||
/* eslint-disable react/jsx-key */
|
/* eslint-disable react/jsx-key */
|
||||||
|
|
||||||
const h = require('../../helpers/h')
|
const h = require('../../helpers/h')
|
||||||
|
const { Editor } = require('slate')
|
||||||
|
|
||||||
module.exports.default = function(value) {
|
module.exports.default = function(value) {
|
||||||
value.document.getTextsAtRange(value.selection)
|
value.document.getTextsAtRange(value.selection)
|
||||||
}
|
}
|
||||||
|
|
||||||
const value = (
|
let value = (
|
||||||
<value>
|
<value>
|
||||||
<document>
|
<document>
|
||||||
{Array.from(Array(10)).map(() => (
|
{Array.from(Array(10)).map(() => (
|
||||||
@@ -23,8 +24,10 @@ const value = (
|
|||||||
</document>
|
</document>
|
||||||
</value>
|
</value>
|
||||||
)
|
)
|
||||||
.change()
|
|
||||||
.moveToRangeOfDocument().value
|
const editor = new Editor({ value })
|
||||||
|
editor.moveToRangeOfDocument()
|
||||||
|
value = editor.value
|
||||||
|
|
||||||
module.exports.input = function() {
|
module.exports.input = function() {
|
||||||
return value
|
return value
|
||||||
|
@@ -27,7 +27,7 @@ class Bench {
|
|||||||
this.name = name
|
this.name = name
|
||||||
this.options = makeOptions({ ...suite.options, ...options })
|
this.options = makeOptions({ ...suite.options, ...options })
|
||||||
this.isFinished = false
|
this.isFinished = false
|
||||||
this.inputer = () => undefined
|
this.inputter = () => undefined
|
||||||
this.runner = () => {}
|
this.runner = () => {}
|
||||||
this.report = { ...errorReport }
|
this.report = { ...errorReport }
|
||||||
suite.addBench(this)
|
suite.addBench(this)
|
||||||
@@ -45,22 +45,22 @@ class Bench {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the method to generate (different} inputs for each run
|
* Set the method to generate (different} inputs for each run
|
||||||
* @param {Array|Function|Scalar} inputer
|
* @param {Array|Function|Scalar} inputter
|
||||||
* @return {void}
|
* @return {void}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
input(inputer) {
|
input(inputter) {
|
||||||
if (Array.isArray(inputer)) {
|
if (Array.isArray(inputter)) {
|
||||||
this.inputer = index => inputer[index % inputer.length]
|
this.inputter = index => inputter[index % inputter.length]
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (typeof inputer === 'function') {
|
if (typeof inputter === 'function') {
|
||||||
this.inputer = inputer
|
this.inputter = inputter
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
this.inputer = () => inputer
|
this.inputter = () => inputter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,7 +84,7 @@ class Bench {
|
|||||||
async compose(times, initial) {
|
async compose(times, initial) {
|
||||||
times = Math.floor(times)
|
times = Math.floor(times)
|
||||||
const isAsync = this.options.async
|
const isAsync = this.options.async
|
||||||
const { runner, inputer } = this
|
const { runner, inputter } = this
|
||||||
|
|
||||||
const { maxTime } = this.options
|
const { maxTime } = this.options
|
||||||
let seq = Number.isFinite(this.options.maxTries) ? 1 : NaN
|
let seq = Number.isFinite(this.options.maxTries) ? 1 : NaN
|
||||||
@@ -125,7 +125,7 @@ class Bench {
|
|||||||
|
|
||||||
function runBundleTasks(tries, initialIndex) {
|
function runBundleTasks(tries, initialIndex) {
|
||||||
const inputs = Array.from({ length: tries }).map(index =>
|
const inputs = Array.from({ length: tries }).map(index =>
|
||||||
inputer(index + initialIndex)
|
inputter(index + initialIndex)
|
||||||
)
|
)
|
||||||
const timer = new Timer()
|
const timer = new Timer()
|
||||||
timer.start()
|
timer.start()
|
||||||
|
Reference in New Issue
Block a user