You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use one hash lookup for successful dynamic-field reads #197
Both FieldMapGet overloads in src/hx/Anon.cpp check __string_hash_exists and then call __string_hash_get for successful reads. This performs two hash calculations and two chain searches for the same key.
These helpers are used by the generated dynamic-field macros in include/hx/Macros.h and MacrosFixed.h, cppia field reads and toString lookup. This is distinct from the compiler-side fixed anonymous-field lookup path.
I ran a focused native probe against checkout 03a4e8d on Linux x86_64 through WSL, Haxe 4.3.3, HXCPP_M64 and hxcpp_smart_strings. A FieldMap held 256 fields; two million successful reads cycled through their keys.
FieldMapGet: 29.762 ms.
Control calling the same backing HashBase::query(key, outValue) once: 13.908 ms.
Both produced checksum 254991808.
This is a single local comparison, not an application-wide speedup. It also includes the difference in helper dispatch, so do not attribute the whole timing difference solely to hashing.
Add or use a single-query helper that returns both presence and the stored Dynamic value. Preserve the distinction between an absent field and a present field containing null. The existing query method already has that contract. Preserve the current outValue behavior on misses too.
Test string-name and field-ID overloads, present null, missing keys, non-ASCII names, collisions and fields added after construction. Measure mixed hit/miss workloads and generated dynamic-class reads, not only the internal helper. This should reduce repeated work without changing table layout or GC policy.
Activity
Look a dynamic field up once in FieldMapGet