On 2007-06-17, Peter Brooks <Peter.H.M.Brooks@[EMAIL PROTECTED]
> wrote:
> The reason is connected to my other question here. If you load lots of
> UML or OWL data using XML's DOM model, it takes quite a while to load
> and fills a fair amount of system memory. To speed things up, it would
> be good to have two stages, first run the program to read in and
> initialise its state from a bit XML file, then, after that, simply
> swap it in from file space ready loaded.
From this story I make up the following:
- The state that you want to store is mostly one or a few trees.
- The overhead is mostly the textprocessing and parsing of the XML models.
Then the solution is easily: Write something that can binary stream the
related structures to disc, and then reload them. (e.g. check first if the
input XMLs are modified, if not, load the cache).
Maybe the units you use to load the XML already have a common ancestor
that
you could enhance or plug to make this happen.
> I know that this could be done with the data contained in a pascal
> 'const' record, or set of records, at compile time, and that might be
> the final solution, but, to my mind, that's a bit messy. I might do it
> that way, if I can't find a better solution - you'd run an
> 'initialise' program that would write source code including the XML
> file that you need included, then compile that, which would be the
> program that you would run. Fast and small as the fpc compiler is,
> though, if I'm going to be having hundreds, or thousands, of such
> programs, it'll be something of an overhead - it would be nicer to
> have the programs initialise themselves.
This is a dead end. You can blockwrite a single record because the
compiler
knows it is one block of memory (assuming it doesn't contain e.g.
dynamically allocated strings). However you can't do this for entire
datastructures that are criss-cross allocated in memory.
> I know that this would be an easier job using python or php, but
> that's the point, I want to avoid repeated interpretive effort to get
> a good response time, recompiling repeatedly would, on balance, leave
> me back in the same sort of world as java, python or php.
While absolutely true, that comes at a cost. Which means you have skilled
progrmaming to do to make that happen.


|