Improve allocation speed and reduce memory copying to increase HTTP pars...

...er performance by 1-2 (and occasionally more) percent in many cases such as benchmark/http/end-vs-write-end.js based on slab allocator todo by Ben.
Thanks for the detailed set of comments Ben.  I will be happy to try to
clean up the benchmarks as a standalone PR based on your feedback and get
them in v0.12 apart from the main http_parser optimizations.  That way we
can concentrate.  I will carefully iterate through all the points and let
you know when I have them all done.

On Sun, Dec 28, 2014 at 9:46 AM, Ben Noordhuis <notifications@github.com>
wrote:

> In benchmark/chunky_http_client.js
> <https://github.com/iojs/io.js/pull/199#discussion-diff-22299098>:
>
> > +  }
> > +  WriteWithCRLF(channel, "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8");
> > +  WriteWithCRLF(channel, "User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.71 Safari/537.36");
> > +  WriteWithCRLF(channel, "Accept-Encoding: gzip, deflate, sdch");
> > +  WriteWithCRLF(channel, "Accept-Language: en-US,en;q=0.8");
> > +  var i;
> > +  for (i = 0; i < extra_header_count; i++) {
> > +    WriteWithCRLF(channel, "X-Header-" + i + ": " + headers[i%3]);
> > +  }
> > +  WriteWithCRLF(channel, "");
> > +}
> > +
> > +var success = 0, failure = 0, min = 10, size = 0, mod = 317, mult = 17, add = 11;
> > +var count = 0;
> > +var t0, tf;
> > +var socket = net.connect("/tmp/unix-node-benchmark.sock", function() {
>
> Ideally, the benchmark should work on all platforms. If you grep
> test/common.js for PIPE, you can find paths that work on Windows and
> Unices:
>
> $ git grep -nw PIPE test/common.js | head -2
> test/common.js:44:  exports.PIPE = '\\\\.\\pipe\\libuv-test';
> test/common.js:47:  exports.PIPE = exports.tmpDir + '/test.sock';
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/iojs/io.js/pull/199/files#r22299098>.
>



-- 
Happy to Code with Integrity : Software Engineering Code of Ethics and
Professional Practice <http://www.acm.org/about/about/se-code>