3 ms·
When you run a program the OS will usually just map the code into address space, it won't necessarily actually load the code from the disk until it needs to. I
by jiggy2011 15y ago
When you run a program the OS will usually just map the code into address space, it won't necessarily actually load the code from the disk until it needs to.
It's possible that what the program is doing at initialization is not loading code from the disk but doing something else, like perhaps checking it has a nice big contiguous area of disk to use for temporary storage or for loading some type of cache into.
There are many times in programming where you make a choice between taking a one-off up front cost to optimise something for faster overall performance vs slower overall performance without the setup cost.
For example with a DBMS you can lose some write performance by having an index on a table and rebalancing when you are writing but the advantage is much faster read performance.
Also A Java program can take longer to run the first time by JIT compiling the program for the platform it is run on but this will mean faster performance of the program itself.