Skip to content

Replace JS_HasProperty + JS_GetProperty with JS_TryGetProperty #105

Open
@bnoordhuis

Description

@bnoordhuis

Problem: the JS_HasProperty + JS_GetProperty pattern shows up quite a bit and it's fairly expensive when the property exists on the prototype chain because it walks the prototype chain twice. Even when the property is on the this object, it still does double work.

Solution: add a JS_TryGetProperty that combines both operations, a la JS_TryGetPropertyInt64.

(JS_TryGetPropertyInt64 could be optimized the same way as well, by the way.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions