mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
Enabled no-self-assign rule in ESLint. This required one change in a benchmark file. Changed a loop (that is outside of the benchmark itself, so performance is not critical) from a for loop that repeats a string to use String.prototype.repeat() instead. While at it, took the opportunity to const-ify the benchmark file. Also moved the "Strict" section in the .eslintrc to match where it is in the ESLint documentation. Updated the link for Strict rules to point to the ESLint website rather than the GitHub-hosted code. PR-URL: https://github.com/nodejs/node/pull/5552 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com> Reviewed-By: Roman Reiss <me@silverwind.io>
17 lines
441 B
JavaScript
17 lines
441 B
JavaScript
'use strict';
|
|
const assert = require('assert');
|
|
const common = require('../common.js');
|
|
|
|
const bench = common.createBenchmark(main, {});
|
|
|
|
function main(conf) {
|
|
const s = 'abcd'.repeat(8 << 20);
|
|
s.match(/./); // Flatten string.
|
|
assert.equal(s.length % 4, 0);
|
|
const b = Buffer(s.length / 4 * 3);
|
|
b.write(s, 0, s.length, 'base64');
|
|
bench.start();
|
|
for (var i = 0; i < 32; i += 1) b.base64Write(s, 0, s.length);
|
|
bench.end(32);
|
|
}
|