Print

Print


> On May 10, 2008, at 1:34 PM, Peter Drake wrote:
>> I'm working on an application where I'd like to frequently call  
>> ECJ and get an answer back quickly (tens of seconds). Is it  
>> possible to keep everything in memory, so there's no need to  
>> access configuration files on disk?
>>
>> Pointers to the appropriate place in the documentation will be  
>> gladly accepted.

It's straightforward to do so, but you'll need to write your own  
Evolve and possibly Output class.

ECJ classes don't read from files: they read from the  
ParameterDatabase.  All you need to do, more or less, is construct a  
ParameterDatabase with all the relevant parameters, however you see  
fit, then point an EvolutionState subclass at it and let it set up  
and run.  You could do this in various ways:

1. Load the ParameterDatabase from a file one time, then reuse it to  
repeatedly build EvolutionStates.  If you do this, I suggest getting  
the latest version off of CVS, as it has a special method (addParent 
(...)), which lets you "wrap" on ParameterDatabase around another,  
protecting it from getting modified by the user (only the outer  
ParameterDatabase can be modified).

2. Create a blank ParameterDatabase, and load it with all relevant  
parameters at runtime.



Some of your problems may have set themselves up to read from data  
files (for example, the 'edge' problem), and you may need to make  
modifications to them so they don't do that.



Last, various Statistics objects write out to one or more statistics  
files (typically 'out.stat').  You can replace the statistics classes  
with a blank Statistics using a parameter like this:

	stat = ec.Statistics
	stat.num-children = 0


Sean