Back to Cosmos

README Reduce TL

code/languages/Java/README_reduce_TL.md

latest1.5 KB
Original Source

Hey Folks! Being in the world of competitive programming, every one of us often face TLE (Time Limit Exceeded) Errors. Reducing TL of one's code is one of the most crucial phase of learning for programmers.

One of the most popular platform for competetive programming is codechef. By-default : Codechef has the TL (Time Limit) for any problem as 1 sec. Java Language has a multiplier of 2 and phython has multiplier of 5.

Java being a heavy language, does uses extra space and time for loading the framework into code-cache along with the main program. But its not the memory issue, one generally faces but TLE.

So, one of the most common way of reducing TL of one's code is to use fast input and otput methods. This really helps. Java is also called a slow language because of its slow input and output. So, many a times, just by adding fast input output to their program and without making any changes in their logic, coders are able to get AC (ALL CORRECT).

Most problem setters explicitly reduce TL and multipliers of their problem so as to force users to learn and use fast input output methods. Moreover, we often encounter problem statements saying: "Warning: Large I/O data, be careful with certain languages (though most should be OK if the algorithm is well designed)”. This is a direct hint given to users to use Faster I/O techniques.

So, this is covered in a greater detail in this article.

Link to the article: https://iq.opengenus.org/reduce-time-limit-of-java-code/