Skip to content

Optimization Problems on Dev Branch #20

@RapperGF

Description

@RapperGF

In the development branch the VM uses MemberResolver which is a nice saftey wrapper around the old way of getting members but introduces a performance regression.

Accessing Native Object fields is known to be expensive due to the use of Dynamic which on static targets is extremely slow. On the main branch the performance expected is around 10 thousand entitles with 6 property sets per frame at around 30 fps.

MemTest_2026-03-14_23-51-55.mp4

On the dev branch this same test leads to a not responding window or very low framerate.

MemTest.2026-05-05.00-53-47.mp4

I did some digging to find the culprit and its due to var instanceFields:Array<String> = nativeClass == null ? null : Type.getInstanceFields(nativeClass);

On native targets such as hxcpp this function is ran in the hot loop scanning every field of the class essentially bottlenecking the VM.

Image

I recommend we either attempt to cache the instanceFields or remove it from MemberResolver.

Metadata

Metadata

Labels

OptimizationAny Performance problems that could be fixed.RegressionA regression of runtime performance or problem.

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions