Long start-up time of a program with include std/
- Posted by Insolor Feb 28, 2012
- 2466 views
Hi to everyone.
I have written a test program to measure a start-up time of a program in Euphoria:
include std/console.e include std/math.e function runit(sequence s, integer n) sequence test = repeat(0,n+2) atom t,d for i = 1 to n do t = time() system("eui " & s, 2) test[i] = time()-t test[n+1] += test[i] end for test[n+1] /= n for i = 1 to n do d = abs(test[n+1]-test[i]) if d>test[n+2] then test[n+2] = d end if end for return test end function constant header = " #1 #2 #3 average delta\n" constant format = "%1.5f %1.5f %1.5f %1.5f %1.5f\n" puts(1,"Running an empty program:\n") puts(1,header) printf(1,format,runit("NUL",3)) system("echo include NUL > nulinc.exw") puts(1,"\n") puts(1,"Running a program that includes an empty file:\n") puts(1,header) printf(1,format,runit("nulinc",3)) system("echo include std/console.e > stdcon.exw") puts(1,"\n") puts(1,"Running a program with an only 'include std/console.e' line:\n") puts(1,header) printf(1,format,runit("stdcon",3)) any_key()
On ASUS notebook with 1.73GHz CPU and 0.98 GB RAM, Win XP SP3, I have got these results:
Running an empty program: #1 #2 #3 average delta 0.25000 0.29700 0.21900 0.25533 0.04167 Running a program that includes an empty file: #1 #2 #3 average delta 0.26600 0.28100 0.25000 0.26567 0.01567 Running a program with an only 'include std/console.e' line: #1 #2 #3 average delta 1.98400 2.03200 2.15600 2.05733 0.09867 Press Any Key to continue...
Why the start-up time of the third program is so long? I guess it is because of the new advanced preprocessor features, used in the standard includes, am I right? Is there any workaround?
P.S. eui version is
Euphoria Interpreter v4.0.3 development Windows, Using Managed Memory Revision Date: 2011-06-24 13:43:18, Id: 4985:26b65e77e3d9