My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 152: Performance issue when casting
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  gameh...@gmail.com
Closed:  Nov 2011


 
Project Member Reported by gameh...@gmail.com, Nov 22, 2011
class Main { 
     static function main() { 
         var a = new A(); 
         var b = new B(); 
         var sum = 0.0;
         var t0 = haxe.Timer.stamp();
         trace("foo a...");
         for(i in 0...10000000)
            for(j in 0...100)
            sum += foo(a); 
         trace(haxe.Timer.stamp()-t0 + sum);

         var t0 = haxe.Timer.stamp();
         trace("foo b...");
         for(i in 0...10000000)
            for(j in 0...100)
               sum += foo(b); 
         trace(haxe.Timer.stamp()-t0 + sum);
     } 
     static function foo(a:A):Float { 
         return a.value; 
     } 
} 

class A { 
     public var value:Float; 
     public function new() {} 
} 

class B extends A { 
     public function new() { 
         super(); 
     } 

}

Nov 22, 2011
Project Member #1 gameh...@gmail.com
Should have fixed this on SVN now.
Status: Fixed

Powered by Google Project Hosting