Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/flatstr/ drwxr-xr-x | |
| Viewing file: Select action/file-type: 'use strict'
var nul = process.platform === 'win32' ? '\\\\.\\NUL' : '/dev/null'
var bench = require('fastbench')
var stream = require('fs').createWriteStream(nul)
var flatstr = require('./')
var largeStr = JSON.stringify(require('./package.json'))
largeStr += largeStr
largeStr += largeStr
var run = bench([
function unflattenedManySmallConcats (cb) {
stream.write(makeStr('a', 200))
setImmediate(cb)
},
function flattenedManySmallConcats (cb) {
stream.write(flatstr(makeStr('a', 200)))
setImmediate(cb)
},
function unflattenedSeveralLargeConcats (cb) {
stream.write(makeStr(largeStr, 10))
setImmediate(cb)
},
function flattenedSeveralLargeConcats (cb) {
stream.write(flatstr(makeStr(largeStr, 10)))
setImmediate(cb)
},
function unflattenedExponentialSmallConcats (cb) {
stream.write(makeExpoStr('a', 12))
setImmediate(cb)
},
function flattenedExponentialSmallConcats (cb) {
stream.write(flatstr(makeExpoStr('a', 12)))
setImmediate(cb)
},
function unflattenedExponentialLargeConcats (cb) {
stream.write(makeExpoStr(largeStr, 7))
setImmediate(cb)
},
function flattenedExponentialLargeConcats (cb) {
stream.write(flatstr(makeExpoStr(largeStr, 7)))
setImmediate(cb)
}
], 10000)
run(run)
function makeStr (str, concats) {
var s = ''
while (concats--) {
s += str
}
return s
}
function makeExpoStr (str, concats) {
var s = str
while (concats--) {
s += s
}
return s
}
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.005 ]-- |