HeapsIO/domkit

Array alloc in applyStyle

trethaller opened this issue · 3 comments

The call to obj.getChildren() causes an hl.types.$ArrayDyn.alloc on hashlink.

	var obj : Model<Dynamic> = e.obj;
	for( c in obj.getChildren() ) {
		var c : Model<Dynamic> = c;
		if( c.dom == null )
			continue;
		applyStyle(c.dom, force);
	}

Considering applyStyle is one of the performance critical spots, maybe a tiny #if domkit_heaps would be worth it here?

There should be no allocation on getChildren, cf h2d.Object:

	#if domkit
	public var dom : domkit.Properties<h2d.Object>;
	@:dox(hide) @:noCompletion public inline function getChildren() return children;
	#end

Alloc is caused by implicit arraydyn cast

Actually... you only need to compile with -D domkit_heaps which is much more efficient (not going through interface as we have typedef Model = h2d.Object)