From cd42f56178c929da84046e750b9306b5656e3144 Mon Sep 17 00:00:00 2001 From: Ben Noordhuis Date: Sat, 2 Feb 2013 00:40:10 +0100 Subject: buffer: optimize Buffer.prototype.write(s, 'hex') Move the implementation to C++ land. This is similar to commit 3f65916 but this time for the write() function and the Buffer(s, 'hex') constructor. Speeds up the benchmark below about 24x (2.6s vs 1:02m). var s = 'f'; for (var i = 0; i < 26; ++i) s += s; // 64 MB Buffer(s, 'hex'); --- src/node_buffer.h | 1 + 1 file changed, 1 insertion(+) (limited to 'src/node_buffer.h') diff --git a/src/node_buffer.h b/src/node_buffer.h index 27991fcfc07..5743f9b2618 100644 --- a/src/node_buffer.h +++ b/src/node_buffer.h @@ -124,6 +124,7 @@ class NODE_EXTERN Buffer: public ObjectWrap { static v8::Handle AsciiWrite(const v8::Arguments &args); static v8::Handle Utf8Write(const v8::Arguments &args); static v8::Handle Ucs2Write(const v8::Arguments &args); + static v8::Handle HexWrite(const v8::Arguments &args); static v8::Handle ReadFloatLE(const v8::Arguments &args); static v8::Handle ReadFloatBE(const v8::Arguments &args); static v8::Handle ReadDoubleLE(const v8::Arguments &args); -- cgit v1.2.3