ngsankha / codejudge

host coding competitions anywhere, anytime
http://sankhs.com/codejudge
MIT License
90 stars 53 forks source link

Slow performances on large input test files. #16

Closed ritesh-nitw closed 11 years ago

ritesh-nitw commented 11 years ago

Your codejudge-compiler is very slow, if the input test files is around 10 MB. Its quite faster for the small test files(1 MB-2 MB), however the judge becomes very slow for large inputs. For 10 MB input files, i remember i have to wait 10 mins to get a judge verdict.

I went through your code, and changing one line , made the judge amazingly fast.The 10 minutes waiting time got reduced to 5 sec (Isn't it amazing - 1000x times faster) - In codejudge-compiler/src/codejudge/compiler/RequestThread.java file: Don't use + operator for concatenating lines. Instead take a string builder and concatenate lines using Java inbuilt 'append' function and at last convert the string builder to string(the return type of the function).

Further optimization:

Try to use Java as much as possible, as Java is 4x times faster than PHP. For example, try to compare the expected and user output only in Java, instead of receiving the entire user program output through socket and comparing it with official output in PHP.

ngsankha commented 11 years ago

Oh, thanks for pointing this out. Can you make the change and submit a pull request?

ritesh-nitw commented 11 years ago

Sure , I will do.