jsPerf.app is an online JavaScript performance benchmark test runner & jsperf.com mirror. It is a complete rewrite in homage to the once excellent jsperf.com now with hopefully a more modern & maintainable codebase.
jsperf.com URLs are mirrored at the same path, e.g:
https://jsperf.com/negative-modulo/2
Can be accessed at:
https://jsperf.app/negative-modulo/2
Testing the performance of the multiline module. This is only a naive micro-benchmark. Please treat it as such.
https://github.com/sindresorhus/multiline
/*!
multiline
Multiline strings in JavaScript
https://github.com/sindresorhus/multiline
by Sindre Sorhus
MIT License
*/
(function () {
'use strict';
// start matching after: comment start block => optional whitespace => newline
// stop matching before: last newline => optional whitespace => comment end block
var reCommentContents = /\/\*\s*(?:\r\n|\n)([\s\S]*?)(?:\r\n|\n)\s*\*\//;
var multiline = function (fn) {
if (typeof fn !== 'function') {
throw new TypeError('Expected a function.');
}
return fn.toString();
};
if (typeof module !== 'undefined' && module.exports) {
module.exports = multiline;
} else {
window.multiline = multiline;
}
})();
Ready to run.
Test | Ops/sec | |
---|---|---|
multiline |
| ready |
string concat |
| ready |
You can edit these tests or add more tests to this page by appending /edit to the URL.