classic-level icon indicating copy to clipboard operation
classic-level copied to clipboard

Avoid passing options objects to C++

Open vweevers opened this issue 3 years ago • 0 comments

If we have to pass say fillCache and asBuffer options from JS to C++, it's faster to pass those as boolean arguments, rather than a { fillCache, asBuffer } object.

In cases where we can't replace use of options objects, we can still optimize that, by replacing napi_has_named_property() and napi_get_named_property() with just one napi_get_named_property() call and checking if the return value is napi_ok.

vweevers avatar Feb 21 '22 18:02 vweevers