2 Replies Latest reply on Jan 7, 2008 10:28 PM by mgrouch

    Method call 1000 times slow in object using @In than new

    Yenan Zhou Newbie

      A test case:

      @Name("test")
      @Scope(ScopeType.CONVERSATION)
      @AutoCreate
      public class Test {
      
       TestMethod testMethodNew = new TestMethod();
      
       @In("testMethod")
       TestMethod testMethodIn;
      
       public void test(){
       System.out.println("start,In:" + System.currentTimeMillis());
       for(int i=0; i<1000; i++) {
       testMethodIn.dummy();
       }
       System.out.println("end ,In:" + System.currentTimeMillis());
      
       System.out.println("start,New:" + System.currentTimeMillis());
       for(int i=0; i<1000; i++) {
       testMethodNew.dummy();
       }
       System.out.println("end ,New:" + System.currentTimeMillis());
       }
      
      }
      
      
      @Name("testMethod")
      @Scope(ScopeType.CONVERSATION)
      @AutoCreate
      public class TestMethod {
       public void dummy() {};
      }
      


      The output is like:
      12:33:08,414 INFO [STDOUT] start,In:1199593988414
      12:33:10,198 INFO [STDOUT] end ,In:1199593990198
      12:33:10,198 INFO [STDOUT] start,New:1199593990198
      12:33:10,199 INFO [STDOUT] end ,New:1199593990199
      


      Could anyone explain this?