Advertisement
Frank84

Add Test

Dec 21st, 2011
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. private function addTest(): void
  2. {
  3.     var vec0:Vector3D = new Vector3D(0, 0, 0);
  4.     var vec1:Vector3D = new Vector3D(Math.random(), Math.random(), Math.random());
  5.    
  6.     Profiler.startTimer("Manual");
  7.     for (var i:int = 0; i < 10000000; i++)
  8.     {
  9.         vec0.x += vec1.x;
  10.         vec0.y += vec1.y;
  11.     }
  12.     Profiler.stopTimer("Manual");
  13.    
  14.     Profiler.startTimer("Auto");
  15.     for (var i:int = 0; i < 10000000; i++)
  16.     {
  17.         vec0.add(vec1);
  18.     }
  19.     Profiler.stopTimer("Auto");
  20.  
  21.     // OUTPUT:
  22.     // Manual : 1171
  23.     // Auto : 5659
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement