summaryrefslogtreecommitdiff
path: root/benchmark/buffers/buffer-swap.js
AgeCommit message (Collapse)Author
2019-07-30benchmark: swap var for let in buffer benchmarksAlex Ramirez
In benchmark buffers directory this changes for loops using var to let when it applies for consistency PR-URL: https://github.com/nodejs/node/pull/28867 Reviewed-By: Jan Krems <jan.krems@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: Rich Trott <rtrott@gmail.com>
2019-06-20benchmark: refactor buffer benchmarksRuben Bridgewater
Currently the buffer benchmarks take significantly too long to complete. This drastically reduces the overall runtime by removing obsolete checked variations and reducing the iteration count. It also improves the benchmarks by removing the deprecated `new Buffer(size)` usage and some other small improvements. PR-URL: https://github.com/nodejs/node/pull/26418 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Peter Marshall <petermarshall@chromium.org> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
2018-04-01tools: add 'spaced-comment' into eslint rulesWeijia Wang
PR-URL: https://github.com/nodejs/node/pull/19596 Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
2018-01-23benchmark: (buffers) use destructuringRuben Bridgewater
PR-URL: https://github.com/nodejs/node/pull/18250 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-09-07benchmark: add default configs to buffer benchmarkRich Trott
Add default values to use for `type` and `method` in `buffer` benchmarks when the provided configuration value is an empty string. This is primarily useful for testing, so the test can request a single iteration without having to worry about providing different valid values for the different benchmarks. While making this change, some `var` instances in immediately surrounding code were changed to `const`. In some cases, `var` had been preserved so that the benchmarks would continue to run in versions of Node.js prior to 4.0.0. However, now that `const` has been introduced into the benchmark `common` module, the benchmarks will no longer run with those versions of Node.js anyway. PR-URL: https://github.com/nodejs/node/pull/15175 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com
2017-04-20benchmark: reduce string concatenationsVse Mozhet Byt
PR-URL: https://github.com/nodejs/node/pull/12455 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2017-03-06benchmark: remove forced optimization from bufferBartosz Sosnowski
This removes all instances of %OptimizeFunctionOnNextCall from buffer benchmarks PR-URL: https://github.com/nodejs/node/pull/9615 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2016-10-19test,lib,benchmark: match function namesRich Trott
In most cases, named functions match the variable or property to which they are being assigned. That also seems to be the practice in a series of PRs currently being evaluated that name currently-anonymous functions. This change applies that rule to instances in the code base that don't comply with that practice. This will be enforceable with a lint rule once we upgrade to ESLint 3.8.0. PR-URL: https://github.com/nodejs/node/pull/9113 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
2016-06-27buffer: speed up swap16/32, add swap64Zach Bjornson
* Speed up buffer.swap16 and swap32 by using builtins. Up to ~6x gain. Drop transition point between JS and C++ implementations accordingly. Amount of performance improvement not only depends on buffer size but also memory alignment. * Fix tests: C++ impl tests were testing 0-filled buffers so were always passing. * Add similar buffer.swap64 method. * Make buffer-swap benchmark mirror JS impl. doc/api/buffer.markdown has an entry of "added: REPLACEME" that should be changed to the correct release number before tagged. Because node is currently using a very old version of cpplint.py it doesn't know that std::swap() has moved from <algorithm> to <utility> in c++11. So until cpplint.py is updated simply NOLINT the line. Technically it should be NOLINT(build/include_what_you_use), but that puts the line over 80 characters causing another lint error. PR-URL: https://github.com/nodejs/node/pull/7157 Reviewed-By: Trevor Norris <trev.norris@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-23buffer: add swap16() and swap32() methodsJames M Snell
Adds Buffer.prototype.swap16() and Buffer.prototype.swap32() methods that mutate the Buffer instance in-place by swapping the 16-bit and 32-bit byte-order. Example: ```js const buf = Buffer([0x1, 0x2, 0x3, 0x4]); buf.swap16(); console.log(buf); // prints Buffer(0x2, 0x1, 0x4, 0x3); buf.swap32(); console.log(buf); // prints Buffer(0x3, 0x4, 0x1, 0x2); ``` PR-URL: https://github.com/nodejs/node/pull/5724 Reviewed-By: Trevor Norris <trev.norris@gmail.com>