diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-03-19 20:18:22 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2019-03-26 16:48:56 +0300 |
commit | 3018441304697fe801fc81385229b5a78a62cc54 (patch) | |
tree | 22d9083a71267574f34a2913a59fe13c6bc564a7 /src/tcp_wrap.cc | |
parent | 53ebd3311d4e0ef184a062b2f657ac69dc8a7acf (diff) |
src: store onread callback in internal field
This gives a slight performance improvement. At 2000 runs:
confidence improvement accuracy (*) (**) (***)
net/net-c2s.js dur=5 type='buf' len=64 *** 0.54 % ±0.16% ±0.21% ±0.27%
PR-URL: https://github.com/nodejs/node/pull/26837
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/tcp_wrap.cc')
-rw-r--r-- | src/tcp_wrap.cc | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index af9806e4889..4d16fa41413 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -80,13 +80,12 @@ void TCPWrap::Initialize(Local<Object> target, Local<String> tcpString = FIXED_ONE_BYTE_STRING(env->isolate(), "TCP"); t->SetClassName(tcpString); t->InstanceTemplate() - ->SetInternalFieldCount(StreamBase::kStreamBaseField + 1); + ->SetInternalFieldCount(StreamBase::kStreamBaseFieldCount); // Init properties t->InstanceTemplate()->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "reading"), Boolean::New(env->isolate(), false)); t->InstanceTemplate()->Set(env->owner_symbol(), Null(env->isolate())); - t->InstanceTemplate()->Set(env->onread_string(), Null(env->isolate())); t->InstanceTemplate()->Set(env->onconnection_string(), Null(env->isolate())); t->Inherit(LibuvStreamWrap::GetConstructorTemplate(env)); |