From 1ed1d1ef4b26dbeacb2386f754b30d8e4dcb30af Mon Sep 17 00:00:00 2001 From: Tom Duncalf Date: Fri, 9 Sep 2022 12:42:07 +0100 Subject: [PATCH] Change to empty string for internal field name --- src/jsi/jsi_class.hpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/jsi/jsi_class.hpp b/src/jsi/jsi_class.hpp index aaace099fa..253234a717 100644 --- a/src/jsi/jsi_class.hpp +++ b/src/jsi/jsi_class.hpp @@ -145,7 +145,10 @@ inline void copyProperty(JsiEnv env, const fbjsi::Object& from, const fbjsi::Obj defineProperty(env, to, name, *prop); } -inline constexpr const char g_internal_field[] = "__Realm_internal"; +// The name used for the property on the JS object which stores the reference to the corresponding C++ object. +// We use an empty string as testing showed it was 1% faster with JSC and 4% faster with Hermes than using +// an actual string, and also has the benefit that it is not a valid Realm object key name. +inline constexpr const char g_internal_field[] = ""; template using ClassDefinition = js::ClassDefinition;