Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Next #110

Closed
wants to merge 1 commit into from
Closed

Next #110

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 27 additions & 24 deletions bench/busboy-form-bench-latin1.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
'use strict'
const { performance } = require('node:perf_hooks')
const Busboy = require('busboy');

const { createMultipartBufferForEncodingBench } = require("./createMultipartBufferForEncodingBench");

for (var i = 0, il = 10000; i < il; i++) { // eslint-disable-line no-var
const boundary = '-----------------------------168072824752491622650073',
busboy = new Busboy({
headers: {
'content-type': 'multipart/form-data; boundary=' + boundary
}
}),
buffer = createMultipartBufferForEncodingBench(boundary, 100, 'iso-8859-1'),
mb = buffer.length / 1048576;
for (var i = 0, il = 10000; i < il; i++) { // eslint-disable-line no-var
const boundary = '-----------------------------168072824752491622650073',
busboy = Busboy({
headers: {
'content-type': 'multipart/form-data; boundary=' + boundary
}
}),
buffer = createMultipartBufferForEncodingBench(boundary, 100, 'iso-8859-1'),
mb = buffer.length / 1048576;

let processedData = 0;
busboy.on('file', (field, file, filename, encoding, mimetype) => {
file.resume()
})
let processedData = 0;
busboy.on('file', (field, file, filename, encoding, mimetype) => {
file.resume()
})

busboy.on('error', function (err) {
})
busboy.on('finish', function () {
})
busboy.on('error', function (err) {
})
busboy.on('finish', function () {
})

const start = +new Date();
const result = busboy.write(buffer, () => { });
busboy.end();
const duration = +new Date - start;
const mbPerSec = (mb / (duration / 1000)).toFixed(2);
console.log(mbPerSec + ' mb/sec');
}
const start = performance.now();
const result = busboy.write(buffer, () => { });
busboy.end();
const duration = performance.now() - start;
const mbPerSec = (mb / (duration / 1000)).toFixed(2);
console.log(mbPerSec + ' mb/sec');
}
51 changes: 27 additions & 24 deletions bench/busboy-form-bench-utf8.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
'use strict'
const { performance } = require('node:perf_hooks')
const Busboy = require('busboy');

const { createMultipartBufferForEncodingBench } = require("./createMultipartBufferForEncodingBench");

for (var i = 0, il = 10000; i < il; i++) { // eslint-disable-line no-var
const boundary = '-----------------------------168072824752491622650073',
busboy = new Busboy({
headers: {
'content-type': 'multipart/form-data; boundary=' + boundary
}
}),
buffer = createMultipartBufferForEncodingBench(boundary, 100, 'utf-8'),
mb = buffer.length / 1048576;
for (var i = 0, il = 10000; i < il; i++) { // eslint-disable-line no-var
const boundary = '-----------------------------168072824752491622650073',
busboy = Busboy({
headers: {
'content-type': 'multipart/form-data; boundary=' + boundary
}
}),
buffer = createMultipartBufferForEncodingBench(boundary, 100, 'utf-8'),
mb = buffer.length / 1048576;

let processedData = 0;
busboy.on('file', (field, file, filename, encoding, mimetype) => {
file.resume()
})
let processedData = 0;
busboy.on('file', (field, file, filename, encoding, mimetype) => {
file.resume()
})

busboy.on('error', function (err) {
})
busboy.on('finish', function () {
})
busboy.on('error', function (err) {
})
busboy.on('finish', function () {
})

const start = +new Date();
const result = busboy.write(buffer, () => { });
busboy.end();
const duration = +new Date - start;
const mbPerSec = (mb / (duration / 1000)).toFixed(2);
console.log(mbPerSec + ' mb/sec');
}
const start = performance.now();
const result = busboy.write(buffer, () => { });
busboy.end();
const duration = performance.now() - start;
const mbPerSec = (mb / (duration / 1000)).toFixed(2);
console.log(mbPerSec + ' mb/sec');
}
5 changes: 4 additions & 1 deletion bench/createMultipartBufferForEncodingBench.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
const Dicer = require('../../deps/dicer/lib/Dicer')
'use strict'
const { performance } = require('node:perf_hooks')
const Dicer = require('../deps/dicer/lib/Dicer')

function createMultipartBuffer(boundary, size) {
const head =
Expand Down Expand Up @@ -49,9 +51,9 @@ for (var i = 0, il = 10; i < il; i++) { // eslint-disable-line no-var
callbacks.end++;
});

const start = +new Date();
const start = performance.now();
d.write(buffer);
const duration = +new Date - start;
const duration = performance.now() - start;
const mbPerSec = (mb / (duration / 1000)).toFixed(2);

console.log(mbPerSec + ' mb/sec');
Expand Down
69 changes: 0 additions & 69 deletions bench/dicer/formidable-bench-multipart-parser.js

This file was deleted.

55 changes: 0 additions & 55 deletions bench/dicer/multipartser-bench-multipart-parser.js

This file was deleted.

76 changes: 0 additions & 76 deletions bench/dicer/multiparty-bench-multipart-parser.js

This file was deleted.

Loading