title: why Jython takes more execution time compare to standalone Python script
body: <p>I am very new to Python/Jython just started 4 weeks back.The issue with execution time for jython script which takes 14 times more compare to standalone same python script.As per my project requirements we need to integrate python/Jython script with Java application.  as per Jython doc i have created JythonFacory class to call the jython script and got the script results. But when i saw the execution time (59 sec) which is a big performance issue. When i ran the same standalone python script in eclipse it was very fast just (3 sec approx). </p>
  
  <p>Could you please suggest me what i should do to get the better performance. Looks like Jython is not a good option for me because of performance issue. Is there any other option to call directly the pure Python script from java without using Jython.jar</p>
  
  <pre><code>public class JythonFactory {
  
  private static JythonFactory instance = null;
  
  public synchronized static JythonFactory getInstance() {
  
      if(instance == null){
  
          instance = new JythonFactory();
  
      }
  
      return instance;
  
  }
  
  public static Object getJythonObject(String interfaceName,Map&lt;String, Object&gt; 
  
      requestTable, String pathToJythonModule) {
  
     Object javaInt = null;
     PythonInterpreter interpreter = new PythonInterpreter();
     interpreter.set("REQUEST_TABLE", requestTable);
  
     interpreter.execfile(pathToJythonModule);
  
     String tempName = pathToJythonModule.substring(pathToJythonModule.lastIndexOf("/")+1);
     tempName = tempName.substring(0, tempName.indexOf("."));
     //System.out.println(tempName);
     String instanceName = tempName.toLowerCase();
     String javaClassName = tempName.substring(0,1).toUpperCase() + tempName.substring(1);
     String objectDef = "=" + javaClassName + "()";
     //System.out.println("instanceName"+instanceName + " objectDef"+objectDef);
     interpreter.exec(instanceName + objectDef);
     try {
         Class JavaInterface = Class.forName(interfaceName);
         javaInt = interpreter.get(instanceName).__tojava__(JavaInterface);
      } catch (ClassNotFoundException ex) {
          ex.printStackTrace();  
      }
  
     return javaInt;
     }
     }
  </code></pre>