This is the mail archive of the guile@cygnus.com mailing list for the guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Guile Startup Time Suggestion


Andrew Archibald <aarchiba@calum.csclub.uwaterloo.ca> writes:

 > hjstein@bfr.co.il (Harvey J. Stein) writes:
 > 
 > > I think you'd be much better off in the short term & in the long run
 > > to get hobbit working to the point where it can easily & reliably
 > > compile the modules into shared libraries.
 > 
 > While it would be nice to get hobbit working, it doesn't address all
 > the problems.  For example, if you want to do something
 > computationally intensive on startup and then dump, unexec will pop it
 > back into memory immediately; but hobbit will do it a little faster
 > than guile would --- maybe reducing the fifteen minutes to ten (I'm
 > serious).
 > 
 > A specific example of this is the lang parsing code, where it does
 > indeed take something like this long (on my machine).  In fact, hobbit
 > wouldn't help much at all here, since a large part of the time is
 > spent initializing the regexp (the giant DFA) which is written in C.

Well, yes.  The two complement each other.
 - hobbiting startup scheme code to make a library speeds up the code
   itself & makes load time negligible, assuming the code doesn't do
   any "work".
 - Dumping would allow fast restarts of computations.

However, it's much easier to write specific dumpers for specific
situations than to write a generic unexec.  In your particular case,
why not write something to do a binary dump of the DFA to a file, &
read it back in when you restart?  Pickling & unpickling specific
data structures when you know their pointers is *much* easier than
writing a generic unexec.

I wrote a fairly simple scheme program which takes very minimal
structure information & generates pascal routines for dumping &
reading the detailed structures.

Bigloo includes a reader & writer for this purpose.

I don't understand a couple of comments you made, though:

1. Are you saying that most of the time is spent in a C fcn which
   initializes the DFA as opposed to Scheme code calling C code
   over & over to generate the DFA?

2. I wrote a Pascal header parser using Bigloo and I never had
   anything even remotely resembling 15 minutes to startup.  And this
   was before compilation.  Why is the language parsing code taking so
   long to generate the DFA?

-- 
Harvey J. Stein
BFM Financial Research
hjstein@bfr.co.il