Projektstart
This commit is contained in:
13
backend/node_modules/@fastify/send/benchmarks/collapseLeadingSlashes.js
generated
vendored
Normal file
13
backend/node_modules/@fastify/send/benchmarks/collapseLeadingSlashes.js
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
'use strict'
|
||||
|
||||
const benchmark = require('benchmark')
|
||||
const collapseLeadingSlashes = require('../lib/collapseLeadingSlashes').collapseLeadingSlashes
|
||||
|
||||
const nonLeading = 'bla.json'
|
||||
const hasLeading = '///./json'
|
||||
|
||||
new benchmark.Suite()
|
||||
.add(nonLeading, function () { collapseLeadingSlashes(nonLeading) }, { minSamples: 100 })
|
||||
.add(hasLeading, function () { collapseLeadingSlashes(hasLeading) }, { minSamples: 100 })
|
||||
.on('cycle', function onCycle (event) { console.log(String(event.target)) })
|
||||
.run({ async: false })
|
||||
15
backend/node_modules/@fastify/send/benchmarks/containsDotFile.js
generated
vendored
Normal file
15
backend/node_modules/@fastify/send/benchmarks/containsDotFile.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict'
|
||||
|
||||
const benchmark = require('benchmark')
|
||||
const { containsDotFile } = require('../lib/containsDotFile')
|
||||
|
||||
const hasDotFileSimple = '.github'.split('/')
|
||||
const hasDotFile = './.github'.split('/')
|
||||
const noDotFile = './index.html'.split('/')
|
||||
|
||||
new benchmark.Suite()
|
||||
.add(hasDotFileSimple.join('/'), function () { containsDotFile(hasDotFileSimple) }, { minSamples: 100 })
|
||||
.add(noDotFile.join('/'), function () { containsDotFile(noDotFile) }, { minSamples: 100 })
|
||||
.add(hasDotFile.join('/'), function () { containsDotFile(hasDotFile) }, { minSamples: 100 })
|
||||
.on('cycle', function onCycle (event) { console.log(String(event.target)) })
|
||||
.run({ async: false })
|
||||
23
backend/node_modules/@fastify/send/benchmarks/isUtf8MimeType.js
generated
vendored
Normal file
23
backend/node_modules/@fastify/send/benchmarks/isUtf8MimeType.js
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
'use strict'
|
||||
|
||||
const benchmark = require('benchmark')
|
||||
const isUtf8MimeType = require('../lib/isUtf8MimeType').isUtf8MimeType
|
||||
|
||||
const applicationJson = 'application/json'
|
||||
const applicationJavascript = 'application/javascript'
|
||||
const textJson = 'text/json'
|
||||
const textHtml = 'text/html'
|
||||
const textJavascript = 'text/javascript'
|
||||
const imagePng = 'image/png'
|
||||
|
||||
new benchmark.Suite()
|
||||
.add('isUtf8MimeType', function () {
|
||||
isUtf8MimeType(applicationJson)
|
||||
isUtf8MimeType(applicationJavascript)
|
||||
isUtf8MimeType(imagePng)
|
||||
isUtf8MimeType(textJson)
|
||||
isUtf8MimeType(textHtml)
|
||||
isUtf8MimeType(textJavascript)
|
||||
}, { minSamples: 100 })
|
||||
.on('cycle', function onCycle (event) { console.log(String(event.target)) })
|
||||
.run({ async: false })
|
||||
14
backend/node_modules/@fastify/send/benchmarks/normalizeList.js
generated
vendored
Normal file
14
backend/node_modules/@fastify/send/benchmarks/normalizeList.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
'use strict'
|
||||
|
||||
const benchmark = require('benchmark')
|
||||
const { normalizeList } = require('../lib/normalizeList')
|
||||
|
||||
const validSingle = 'a'
|
||||
const validArray = ['a', 'b', 'c']
|
||||
|
||||
new benchmark.Suite()
|
||||
.add('false', function () { normalizeList(false) }, { minSamples: 100 })
|
||||
.add('valid single', function () { normalizeList(validSingle) }, { minSamples: 100 })
|
||||
.add('valid array', function () { normalizeList(validArray) }, { minSamples: 100 })
|
||||
.on('cycle', function onCycle (event) { console.log(String(event.target)) })
|
||||
.run({ async: false })
|
||||
15
backend/node_modules/@fastify/send/benchmarks/parseBytesRange.js
generated
vendored
Normal file
15
backend/node_modules/@fastify/send/benchmarks/parseBytesRange.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
'use strict'
|
||||
|
||||
const benchmark = require('benchmark')
|
||||
const { parseBytesRange } = require('../lib/parseBytesRange')
|
||||
|
||||
const size150 = 150
|
||||
|
||||
const rangeSingle = 'bytes=0-100'
|
||||
const rangeMultiple = 'bytes=0-4,90-99,5-75,100-199,101-102'
|
||||
|
||||
new benchmark.Suite()
|
||||
.add('size: 150, bytes=0-100', function () { parseBytesRange(size150, rangeSingle) }, { minSamples: 100 })
|
||||
.add('size: 150, bytes=0-4,90-99,5-75,100-199,101-102', function () { parseBytesRange(size150, rangeMultiple) }, { minSamples: 100 })
|
||||
.on('cycle', function onCycle (event) { console.log(String(event.target)) })
|
||||
.run({ async: false })
|
||||
Reference in New Issue
Block a user