1 2 Previous Next 17 Replies Latest reply: Feb 22, 2008 12:06 PM by 796440 RSS

    why does the performance goes bad inside a loop when they are many iteratio

    Melssj5
      Hi I have a doubt. for example.

      I have:
      for (int i=0;i<32000;i++) {
             do_some_light_work ();
      }
      now the problem is that the first 1000 iterations goes very fast but then it began to be each time more and more slow for each iteration. the work I am doing on each iteration is always the same so its not due to do_some_light_work (); takes more time. I also have tested calling to System.gc () on each 50 iterations but it always become slower.

      How can I fix this.
        1 2 Previous Next