Issue Description
A script that parses XML takes only 0.00718 seconds to execute through Python, but it takes 17 seconds to execute through Python4J. Why is there such a difference in performance?
Version Information
Please indicate relevant versions, including, if relevant:
- Deeplearning4j version: the latest version
- Platform information : windows
the java code:
`public static void parserOverlay(){
try(PythonGIL pythonGIL = PythonGIL.lock()) {
try(PythonGC gc = PythonGC.watch()) {
//inputs
byte[] xml_data_bytes = FileUtils.readFileToByteArray(new File("D:\software\BaiduNetdisk\download\231108\231108\MGT\TE01214\KTOVLRAW_TE01214_OL.xml"));
List inputs = new ArrayList<>();
inputs.add(new PythonVariable<>("xml_data_bytes", PythonTypes.BYTES, xml_data_bytes));
//outputs
List<PythonVariable> outputs = new ArrayList<>();
outputs.add(new PythonVariable<>("lotRunJson", PythonTypes.DICT));
outputs.add(new PythonVariable<>("machineRcpJson", PythonTypes.DICT));
outputs.add(new PythonVariable<>("imageJson", PythonTypes.DICT));
outputs.add(new PythonVariable<>("waferRunJson", PythonTypes.DICT));
outputs.add(new PythonVariable<>("targetJson", PythonTypes.DICT));
outputs.add(new PythonVariable<>("measurementJson", PythonTypes.DICT));
outputs.add(new PythonVariable<>("measurementResultJson", PythonTypes.DICT));
String code = FileUtils.readFileToString(new File("D:\\resource\\LithoTuner-Python\\DataParser_Overlay.py"),
StandardCharsets.UTF_8);
long startTime = System.currentTimeMillis();
PythonExecutioner.exec(code, inputs, outputs);
long endTime = System.currentTimeMillis();
System.out.println("cost time:" + (endTime - startTime)/1000.0);
for(PythonVariable output : outputs){
System.out.println(output.getName() + " : " + output.getValue());
}
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}`
what's wrong?