diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-02-02 00:40:10 +0100 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-02-02 01:01:42 +0100 |
commit | cd42f56178c929da84046e750b9306b5656e3144 (patch) | |
tree | 927446d08728f20c4d8852aca0a7e59117277829 /src/node_buffer.h | |
parent | 916aebabb83745dd7b1402a92f120107fa6ea6b6 (diff) | |
download | node-cd42f56178c929da84046e750b9306b5656e3144.tar.gz |
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');
Diffstat (limited to 'src/node_buffer.h')
-rw-r--r-- | src/node_buffer.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/node_buffer.h b/src/node_buffer.h index 27991fcfc..5743f9b26 100644 --- a/src/node_buffer.h +++ b/src/node_buffer.h @@ -124,6 +124,7 @@ class NODE_EXTERN Buffer: public ObjectWrap { static v8::Handle<v8::Value> AsciiWrite(const v8::Arguments &args); static v8::Handle<v8::Value> Utf8Write(const v8::Arguments &args); static v8::Handle<v8::Value> Ucs2Write(const v8::Arguments &args); + static v8::Handle<v8::Value> HexWrite(const v8::Arguments &args); static v8::Handle<v8::Value> ReadFloatLE(const v8::Arguments &args); static v8::Handle<v8::Value> ReadFloatBE(const v8::Arguments &args); static v8::Handle<v8::Value> ReadDoubleLE(const v8::Arguments &args); |