I have a Java application which does the following:
- Tool takes a document which it will parse.
- Tool calls external webservice
- Tool completes execution
However, when I tried to run this application in two different 'environments', there is a huge gap between the performance of the tool. On the first environment, it takes only 30 seconds, while on the second tool, it took 40 minutes.
An environment consists of the following:
- The machine the app runs on.
- The connection to the webservice.
- The input document that will be parsed by the tool.
I have been in constant communication between the people on the second environment (40 minute execution), and I am quite stumped.
I am trying to isolate the issue. First, I asked the specs of the machine that they are using and that seems to be fine. I then asked their connection to the webservice and it is okay too.
The input document between the two environments (For this case), are the same; I kept it a constant variable so that I have less issues to check.
Weirdly enough, I asked for more information and found out that it takes a long time with the parsing of the input document. In the 40 minute execution, the tool was 'stuck' on the parsing for 38 minutes. I was thinking if it was my code, but I am quite confused that the first environment only took seconds to parse the same document.
The general structure of my parsing is as follows:
do{
... code here.
do {
... code here.
for{}
}while
}while
for{}
do{
... code here.
}while
code here
are mixtures of if statements and function calls (only one function is used though and it is just generally ifs, no loops).
I do know that nested loops take a while and this is worse than O(n^2)
and I know I need to work on my optimization, but could it really be the code that causes this huge gap between performance or is there another factor that may cause this gap?