0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 07:27:22 +01:00
Commit Graph

282 Commits

Author SHA1 Message Date
Jackson Tian
089c6a4fba http: speed up checkIsHttpToken
The Regex implementation is not faster than ascii code compare.

the field name is shorter, the speed is faster.

benchmark result here:

https://bitbucket.org/snippets/JacksonTian/Rnbad/benchmark-result

PR-URL: https://github.com/nodejs/node/pull/4790
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-03-27 13:58:26 -07:00
Jackson Tian
afd821a91d buffer: faster case for create buffer from empty string
When create Buffer from empty string will touch
C++ binding also.

This patch can improve edge case ~70% faster.

PR-URL: https://github.com/nodejs/node/pull/4414
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-27 09:14:48 -07:00
James M Snell
7d73e60f60 buffer: add swap16() and swap32() methods
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>
2016-03-23 08:52:44 -07:00
Rich Trott
cde81b6b9f benchmark: fix linting errors
4d78121b77 had lint errors that went
undetected. This fixes them.

PR-URL: https://github.com/nodejs/node/pull/5840
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Myles Borins <myles.borins@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-21 20:55:33 -07:00
Jackson Tian
4d78121b77 lib: simplify code with String.prototype.repeat()
use String.prototype.repeat() to simplify code, less code,
more semantically.

PR-URL: https://github.com/nodejs/node/pull/5359
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-21 16:42:58 -07:00
Brian White
089bef0a81 timers: improve setImmediate() performance
This commit improves setImmediate() performance by moving the
try-finally block that wraps callback execution into a separate
function because currently v8 never tries to optimize functions
that contain try-finally blocks.

With this change, there is a ~20-40% improvement in the included
setImmediate() depth benchmarks. The breadth benchmarks show a slight
improvement.

PR-URL: https://github.com/nodejs/node/pull/4169
Reviewed-By: Minwoo Jung <jmwsoft@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2016-03-18 19:25:51 -04:00
James M Snell
85ab4a5f12 buffer: add .from(), .alloc() and .allocUnsafe()
Several changes:

* Soft-Deprecate Buffer() constructors
* Add `Buffer.from()`, `Buffer.alloc()`, and `Buffer.allocUnsafe()`
* Add `--zero-fill-buffers` command line option
* Add byteOffset and length to `new Buffer(arrayBuffer)` constructor
* buffer.fill('') previously had no effect, now zero-fills
* Update the docs

PR-URL: https://github.com/nodejs/node/pull/4682
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
2016-03-16 08:34:02 -07:00
Rich Trott
810aa9f6c3 tools: enable no-self-assign ESLint rule
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>
2016-03-07 10:07:17 -08:00
Evan Lucas
735e0df8e4 benchmark: add util.format benchmark
PR-URL: https://github.com/nodejs/node/pull/5360
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-04 17:27:10 -06:00
Rich Trott
1bedeeb41d benchmark: fix lint errors
PR-URL: https://github.com/nodejs/node/pull/5517
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-03-03 09:53:22 -08:00
Anton Khlynovskiy
c647e87504 lib: freelist: use .pop() for allocation
Array#pop() is known to be faster than Array#shift().
To be exact, it's O(1) vs. O(n). In this case there's no difference
from which side of the "pool" array the object is retrieved,
so .pop() should be preferred.

PR-URL: https://github.com/nodejs/node/pull/2174
Reviewed-By: mscdex - Brian White <mscdex@mscdex.net>
Reviewed-By: jasnell - James M Snell <jasnell@gmail.com>
Reviewed-By: ofrobots - Ali Ijaz Sheikh <ofrobots@google.com>
2016-03-02 09:24:24 -08:00
Rich Trott
76e4a74377 benchmark: refactor to eliminate redeclared vars
In order to comply with linting rules used in the rest of the code base,
eliminate redeclared variables. A conservative approach is used so as to
avoid unintentional performance issues (for example, as might be seen in
some situations when using `let` instead of `var`).

PR-URL: https://github.com/nodejs/node/pull/5468
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-03-01 13:48:42 -08:00
Rich Trott
ffdc046e5c benchmark: add benchmark for buf.compare()
There is a benchmark for the class method `Buffer.compare()` but not for
the instance method `buf.compare()`. This adds that benchmark.

I used this to confirm a performance regression in an implementation I
was considering. While the implementation was a bust, it does seem like
the benchmark is worthwhile.

The benchmark is nearly identical to the existing `Buffer.compare()`
benchmark except, of course, that it calls `buf.compare()` instead.

PR-URL: https://github.com/nodejs/node/pull/5441
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Evan Lucas <evanlucas@me.com>
2016-02-27 20:17:56 -08:00
Rich Trott
dcfda1007b tools,benchmark: increase lint compliance
In the hopes of soon having the benchmark code linted, this change
groups all the likely non-controversial lint-compliance changes such as
indentation, semi-colon usage, and single-vs.-double quotation marks.

Other lint rules may have subtle performance implications in the V8
currently shipped with Node.js. Those changes will require more careful
review and will be in a separate change.

PR-URL: https://github.com/nodejs/node/pull/5429
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Brian White <mscdex@mscdex.net>
2016-02-27 20:15:17 -08:00
Andreas Madsen
2426b3dd86 benchmark: move string-decoder to its own category
PR-URL: https://github.com/nodejs/node/pull/5177
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2016-02-26 20:29:20 +11:00
Andreas Madsen
15720fa25a benchmark: fix configuation parameters
The benchmark runner spawns new processes for each configuration. The
specific configuration is transfered by process.argv. This means that
the values have to be parsed. As of right now only numbers and strings
are parsed correctly. However other values such as objects where used.

This fixes the benchmarks that used non-string/number values and
prevents future issues by asserting the type.

PR-URL: https://github.com/nodejs/node/pull/5177
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2016-02-26 20:29:10 +11:00
Andreas Madsen
f6c505d0b1 benchmark: merge url.js with url-resolve.js
url.js was broken since it didn't use the common.js runner. This fixes
that issue by merging it with url-resolve.js, which also benchmarks
url.resolve.

PR-URL: https://github.com/nodejs/node/pull/5177
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2016-02-26 20:29:05 +11:00
Andreas Madsen
d9079ab801 benchmark: move misc to categorized directories
PR-URL: https://github.com/nodejs/node/pull/5177
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rod Vagg <rod@vagg.org>
2016-02-26 20:28:45 +11:00
Rich Trott
4bb529d972 benchmark: use strict mode
Apply strict mode to benchmark code.

PR-URL: https://github.com/nodejs/node/pull/5336
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2016-02-22 11:09:26 -08:00
Brian White
00638ac160 querystring: improve escape() performance
This commit improves escape() performance by up to 15% with the
existing querystring-stringify benchmarks by reducing the number
of string concatentations. A potential deopt is also avoided by
making sure the index passed to charCodeAt() is within bounds.

PR-URL: https://github.com/nodejs/node/pull/5012
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2016-02-12 20:00:22 -05:00
Brian White
a2a69a2b63 querystring: improve parse() performance
This commit improves parse() performance by ~20-200% with the various
querystring-parse benchmarks.

Some optimization strategies used in this commit include:
* Combining multiple searches (for '&', '=', and '+') on the same
   string into a single loop
* Avoiding string.split()
* Minimizing creation of temporary strings
* Avoiding string decoding if no encoded bytes were found and the
   default string decoder is being used

PR-URL: https://github.com/nodejs/node/pull/5012
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
2016-02-12 19:59:49 -05:00
Brian White
e1348b0819 benchmark: split path benchmarks
This commit splits each path benchmark into separate posix and
Windows benchmark files. This allows benchmarking (platform-)specific
inputs against specific platforms (only).

PR-URL: https://github.com/nodejs/node/pull/5123
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-02-09 20:35:35 -08:00
Brian White
72d0f88215 benchmark: allow empty parameters
PR-URL: https://github.com/nodejs/node/pull/5123
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-02-09 20:35:19 -08:00
Matteo Collina
7764b6cb96 streams: 5% throughput gain when sending small chunks
Improves the performance when moving small buffers by 5%,
and it adds a benchmark to avoid regression in that area.
In all other cases it is equally performant to current master.

Full performance results available at:
https://gist.github.com/mcollina/717c35ad07d15710b6b9.

PR-URL: https://github.com/nodejs/node/pull/4354
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-02-09 09:30:12 +00:00
Matteo Collina
137f53c7b7 dgram: support dgram.send with multiple buffers
Added ability to dgram.send to send multiple buffers, _writev style.
The offset and length parameters in dgram.send are now optional.
Refactored the dgram benchmarks, and seperated them from net.
Added docs for the new signature.

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
Fixes: https://github.com/nodejs/node/issues/4302
PR-URL: https://github.com/nodejs/node/pull/4374
2016-01-29 19:26:44 +01:00
Minwoo Jung
4126441013 benchmark: add a constant declaration for net
Constant declaration for `net` is omitted in `idle_server.js`
Add a constant declaration for constant `net`

PR-URL: https://github.com/nodejs/node/pull/3950
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2016-01-29 20:40:35 +09:00
Brian White
4bc1a47761 querystring: improve parse() performance
These changes improve parse() performance from ~11-30% on all of
the existing querystring benchmarks.

PR-URL: https://github.com/nodejs/node/pull/4675
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2016-01-14 18:02:52 -08:00
Jackson Tian
3e740caaf3 util: faster arrayToHash
The `util.format()` is used frequently, make the method faster
is better.

R-URL: https://github.com/nodejs/node/pull/3964
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-12-30 11:54:26 -08:00
Jackson Tian
5396baf7c1 buffer: faster case for create Buffer from new Buffer(0)
When create Buffer from a Buffer will copy data
from old to new even though length is zero.

This patch can improve edge case 4x faster.
following is benchmark results.

new: buffers/buffer_zero.js n=1024: 2463.53891
old: buffers/buffer_zero.js n=1024: 618.70801

PR-URL: https://github.com/nodejs/node/pull/4326
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
2015-12-23 17:15:19 -08:00
Claudio Rodriguez
63786227cc assert: typed array deepequal performance fix
assert.deepEqual: when actual and expected are typed arrays,
wrap them in a new Buffer each to increase performance
significantly.

PR-URL: https://github.com/nodejs/node/pull/4330
Fixes: https://github.com/nodejs/node/issues/4294
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2015-12-21 18:04:01 +01:00
Trevor Norris
56985ca258 node: improve accessor perf of process.env
Set process.env array entries in JS.

PR-URL: https://github.com/nodejs/node/pull/3780
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-12-17 17:29:31 -07:00
Trevor Norris
36e8a2c63d node: improve performance of hrtime()
process.hrtime() was performing too many operations in C++ that could be
done faster in JS. Move those operations over by creating a length 4
Uint32Array and perform bitwise operations on the seconds so that it was
unnecessary for the native API to do any object creation or set any
fields.

This has improved performance from ~350 ns/op to ~65 ns/op. Light
benchmark included to demonstrate the performance change.

PR-URL: https://github.com/nodejs/node/pull/3780
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-12-17 17:29:16 -07:00
Trevor Norris
0fde28ce37 fs: use pushValueToArray for readdir(Sync)
Improve performance by pushing directory entries to returned array in
batches of 8 using pushValueToArray() in JS. Add benchmarks to
demonstrate this improvement.

PR-URL: https://github.com/nodejs/node/pull/3780
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-12-17 17:29:06 -07:00
Trevor Norris
d39ace16ba http_parser: use pushValueToArray for headers
For performance add headers to the headers Array by pushing them on from
JS. Benchmark added to demonstrate this case.

PR-URL: https://github.com/nodejs/node/pull/3780
Reviewed-By: Fedor Indutny <fedor@indutny.com>
2015-12-17 17:28:53 -07:00
Myles Borins
b619831381 meta: remove use of profanity in source
The CoC requests to avoid the casual use of profanity.

PR-URL: https://github.com/nodejs/node/pull/4122
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: targos - Michaël Zasso <mic.besace@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2015-12-02 11:05:11 -08:00
Karl Skomski
a18dd7b788 src: replace naive search in Buffer::IndexOf
Adds the string search implementation from v8
which uses naive search if pattern length < 8
or to a specific badness then uses Boyer-Moore-Horspool

Added benchmark shows the expected improvements
Added option to use ucs2 encoding with Buffer::IndexOf

Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
PR-URL: https://github.com/nodejs/node/pull/2539
2015-10-07 21:09:53 -07:00
Minwoo Jung
f1d27d27f5 benchmark: update comment in common.js
Very minor update in benchmark/common.js
Not exactly a critical change, just continued cleaning
out of old joyent/node PRs that never landed.

Ref: https://github.com/nodejs/node-v0.x-archive/pull/8515
PR-URL: https://github.com/nodejs/node/pull/2399
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
Reviewed-By: Michaël Zasso <mic.besace@gmail.com>
2015-09-29 16:00:04 -07:00
Dmitry Vasilyev
942da888b5 doc: rename from iojs(1) to node(1) in benchmarks
Examples in the benchmark readme previously sill referenced iojs(1).

PR-URL: https://github.com/nodejs/node/pull/2884
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-09-15 14:02:02 -04:00
Michaël Zasso
4abc896a82 src: replace usage of v8::Handle with v8::Local
v8::Handle is deprecated: https://codereview.chromium.org/1224623004

PR-URL: https://github.com/nodejs/io.js/pull/2202
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-09-06 21:38:05 +10:00
cjihrig
a69ab27ab4 node: rename from io.js to node
This commit replaces instances of io.js with Node.js, based on the
recent convergence. There are some remaining instances of io.js,
related to build and the installer.

Fixes: https://github.com/nodejs/node/issues/2361
PR-URL: https://github.com/nodejs/node/pull/2367
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: João Reis <reis@janeasystems.com>
2015-08-23 17:59:43 -04:00
Sakthipriyan Vairamani
8f58fb92ff events: deprecate static listenerCount function
As per the discussion in #734, this patch deprecates the usage of
`EventEmitter.listenerCount` static function in the docs, and introduces
the `listenerCount` function in the prototype of `EventEmitter` itself.

PR-URL: https://github.com/nodejs/node/pull/2349
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Brian White <mscdex@mscdex.net>
2015-08-20 03:17:08 +05:30
Nathan Woltman
99d9d7e716 benchmark: add remaining path benchmarks & optimize
As a follow-up to 0d15161, this commit adds benchmarks for the rest
of the path functions and also forces V8 to optimize the functions
before starting the benchmark test.

PR-URL: https://github.com/nodejs/io.js/pull/2103
Reviewed-By: Brendan Ashworth <brendan.ashworth@me.com>
2015-07-26 22:17:41 -07:00
Ben Noordhuis
8fd3ce100e src: make base64 decoding 50% faster
Make the inner loop execute fewer compare-and-branch executions per
processed byte, resulting in a 50% or more speedup.

This coincidentally fixes an out-of-bounds read:

    while (unbase64(*src) < 0 && src < srcEnd)

Should have read:

    while (src < srcEnd && unbase64(*src) < 0)

But this commit removes the offending code altogether.

Fixes: https://github.com/nodejs/io.js/issues/2166
PR-URL: https://github.com/nodejs/io.js/pull/2193
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-07-25 19:07:23 +02:00
Nathan Woltman
0d15161c24 benchmark: Add some path benchmarks for #1778
Path functions being benchmarked are:
* format
* isAbsolute
* join
* normalize
* relative
* resolve

PR-URL: https://github.com/nodejs/io.js/pull/1778
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
2015-07-04 13:30:20 +02:00
Rich Trott
05a73c0f25 benchmark: make concurrent requests configurable
In http_bench.js, allow the concurrent requests per client
to be configurable.

This also changes the launch of clients to wait until all
forked servers are online. This eliminates spurious error
messages at the start of the run.

PR-URL: https://github.com/nodejs/io.js/pull/2068
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-06-29 23:01:53 -07:00
Rich Trott
f52d73352e benchmark: fix typo in README
PR-URL: https://github.com/nodejs/io.js/pull/2067
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
2015-06-29 10:11:52 -07:00
Ben Noordhuis
8350f3a3a2 buffer: optimize Buffer#toString()
Break up Buffer#toString() into a fast and slow path.  The fast path
optimizes for zero-length buffers and no-arg method invocation.

The speedup for zero-length buffers is a satisfying 700%.  The no-arg
toString() operation gets faster by about 13% for a one-byte buffer.

This change exploits the fact that most Buffer#toString() calls are
plain no-arg method calls.  Rewriting the method to take no arguments
means a call doesn't go through an ArgumentsAdaptorTrampoline stack
frame in the common case.

PR-URL: https://github.com/nodejs/io.js/pull/2027
Reviewed-By: Brian White <mscdex@mscdex.net>
Reviewed-By: Christian Tellnes <christian@tellnes.no>
Reviewed-By: Daniel Cousens <email@dcousens.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-06-25 18:32:15 +02:00
Jeremiah Senkpiel
dbd5dc932d doc: clarify prerequisites in benchmark/README.md
PR-URL: https://github.com/nodejs/io.js/pull/2034
Reviewed-By: Evan Lucas <evanlucas@me.com>
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
2015-06-24 09:57:22 -07:00
Rich Trott
5c2707c1b2 doc: benchmark/README.md copyedit
PR-URL: https://github.com/nodejs/io.js/pull/1970
Reviewed-By: Johan Bergström <bugs@bergstroem.nu>
2015-06-15 08:44:11 -07:00
Brendan Ashworth
9da168b71f buffer: optimize Buffer.byteLength
Buffer.byteLength is important for speed because it is called whenever a
new Buffer is created from a string.

This commit optimizes Buffer.byteLength execution by:
- moving base64 length calculation into JS-land, which is now much
  faster
- remove redundant code and streamline the UTF8 length calculation

It also adds a benchmark and better tests.

PR-URL: https://github.com/nodejs/io.js/pull/1713
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
2015-05-22 15:31:03 -07:00