Skip to content

gi/wrapperutils: Move gjs_get_string_id() into resolve() implementations

Jonas Dreßler requested to merge wip/verdre/get-string-inside-resolve_impl into master

Calling gjs_get_string_id() allocates a string, which can be quite expensive and should be avoided in hot-paths. There are some resolve() implementations which don't need the prop_name string and can return without it, most notably the implementation of ObjectPrototype, which has an unresolvable cache. If we hit that cache, there's no need to create the string.

So move the call to gjs_get_string_id() into the implementations of resolve() and make sure ObjectPrototype::resolve() avoids calling it in case we hit the unresolvable cache.

Merge request reports