1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 07:17:35 +00:00

LibJS: Get rid of unnecessary work from canonical_numeric_index_string

The spec version of canonical_numeric_index_string is absurdly complex,
and ends up converting from a string to a number, and then back again
which is both slow and also requires a few allocations and a string
compare.

Instead lets use the logic we already have as that is much more
efficient.

This improves performance of all non-numeric property names.
This commit is contained in:
Anonymous 2022-02-12 12:51:06 -08:00 committed by Andreas Kling
parent 44a2ebea00
commit 3a184f7841
8 changed files with 57 additions and 98 deletions

View file

@ -55,6 +55,7 @@ public:
bool is_undefined() const { return m_type == Type::Undefined; }
bool is_null() const { return m_type == Type::Null; }
bool is_number() const { return m_type == Type::Int32 || m_type == Type::Double; }
bool is_int32() const { return m_type == Type::Int32; }
bool is_string() const { return m_type == Type::String; }
bool is_object() const { return m_type == Type::Object; }
bool is_boolean() const { return m_type == Type::Boolean; }