PeakGen
PeakGen

Reputation: 23035

Do short paths to source files make Java code run faster?

Does a short path makes Java code to run faster? For example, will a file in "C:\Java\test.java" run faster than the same file in "C:\Users\Sepala\Documents\NetBeansProjects\BeanSupport\src\ejb\test.java"?

Upvotes: 0

Views: 107

Answers (3)

manurajhada
manurajhada

Reputation: 5380

Its not your cup of tea just decide the path and let your code reach up-to. Its Even not noticeable for you. Your is to make sure about file existence and access permissions over it.

Upvotes: 1

Brad
Brad

Reputation: 9223

If you want to test this out, write yourself a Timer class.

public class Timer
{
    private long mInitialTime;

    public Timer()
    {
        start();
    }

    public void start()
    {
        mInitialTime = System.currentTimeMillis();
    }

    public String end(String description)
    {
        long finalTime = System.currentTimeMillis() - mInitialTime;
        return description + ": total time " + finalTime;
    }
}

At the start of main() call start() then at the end of main() call end("completed").

Upvotes: 3

Miquel
Miquel

Reputation: 15675

Being practical, it's not going to make a difference. Being very picky, your filesystem might have an influence, but it's not going to be something you'll notice.

Upvotes: 7

Related Questions