Skip to content

Commit 609c489

Browse files
committed
performance fix for js
1 parent 2a18e3a commit 609c489

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

hscript/Interp.hx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,6 +556,11 @@ class Interp {
556556
function makeIterator( v : Dynamic ) : Iterator<Dynamic> {
557557
#if ((flash && !flash9) || (php && !php7 && haxe_ver < '4.0.0'))
558558
if ( v.iterator != null ) v = v.iterator();
559+
#elseif js
560+
// don't use try/catch (very slow)
561+
if( v is Array )
562+
return (v : Array<Dynamic>).iterator();
563+
if( v.iterator != null ) v = v.iterator();
559564
#else
560565
try v = v.iterator() catch( e : Dynamic ) {};
561566
#end

0 commit comments

Comments
 (0)