Files
node/src
Kenny Yuan e41ccd4e2d n-api: improve runtime perf of n-api func call
Added a new struct CallbackBundle to eliminate all
GetInternalField() calls.

The principle is to store all required data inside a C++ struct,
and then store the pointer in the JavaScript object. Before this
change, the required data are stored in the JavaScript object in
3 or 4 seperate pointers. For every napi fun call, 3 of them
have to be fetched out, which are 3 GetInternalField() calls;
after this change, the C++ struct will be directly fetched out
by using v8::External::Value(), which is faster.

Profiling data show that GetInternalField() is slow.
On an i7-4770K (3.50GHz) box, a C++ V8-binding fun call is 8 ns,
before this change, napi fun call is 36 ns; after this change,
napi fun call is 20 ns.

The above data are measured using a modified benchmark in
'benchmark/misc/function_call'. The modification adds an indicator
of the average time of a "chatty" napi fun call (max 50M runs).
This change will speed up chatty case 1.8x (overall), and will cut
down the delay of napi mechanism to approx. 0.5x.

Background: a simple C++ binding function (e.g. receiving little
from JS, doing little and returning little to JS) is called
'chatty' case for JS<-->C++ fun call routine.

This improvement also applies to getter/setter fun calls.

PR-URL: https://github.com/nodejs/node/pull/21072
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
2018-06-07 22:56:20 -04:00
..
…
2018-06-06 19:43:52 +02:00
2017-11-27 07:21:08 +01:00
2018-06-06 19:43:52 +02:00
2018-06-06 19:43:52 +02:00
2018-06-08 00:26:39 +02:00
2018-06-06 19:43:41 +02:00
2018-06-05 09:09:06 -07:00
2018-06-05 09:09:06 -07:00
2018-06-05 09:09:06 -07:00
2018-06-05 09:09:06 -07:00
2018-06-06 19:43:52 +02:00
2018-05-10 14:15:16 +02:00
2018-05-20 14:15:56 -07:00
2017-09-14 17:38:38 +02:00
2018-06-08 00:50:34 +02:00
2017-09-14 17:38:38 +02:00
2017-12-01 07:45:00 +01:00
2018-04-03 13:57:41 -07:00
2018-06-06 19:43:52 +02:00
2018-06-06 19:43:52 +02:00
…
2018-04-25 12:22:47 -03:00
2018-05-10 14:15:16 +02:00
2018-05-30 05:19:13 +02:00
2018-05-10 14:15:16 +02:00
2018-05-30 05:19:13 +02:00
2018-06-01 09:59:50 +02:00