Re: Saving program state in executable



On 2007-06-17, Peter Brooks <Peter.H.M.Brooks@xxxxxxxxx> 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.
.



Relevant Pages

  • Memory limitation with owc?
    ... spreadsheets that I want to load into memory. ... loading a number of large xml files. ...
    (microsoft.public.office.developer.web.components)
  • Re: Whats an efficient way of insertring elements into an XML document
    ... > XmlDocument.Load() will load all that into memory each time you open ... and then parse all of the data and build an in memory ... Have you considered using a format other than XML? ...
    (microsoft.public.dotnet.framework)
  • Re: Accessing a Web Service From BTS Orchestration
    ... worst from a performance standpoint) is to load the Xml into an ... the web service you wish to consume. ... It loads the entire message into memory ... xml into the new message with its body part created as an instance of ...
    (microsoft.public.biztalk.general)
  • Instantiate expensive object *once* in JSP/Tomcat
    ... I have an object that is very expensive in terms of time (it reads in an XML ... mapping file). ... How do I load this object into memory once - and once only - when the server ...
    (comp.lang.java.programmer)
  • Re: Scripting (ECMA script) solution for .NET app?
    ... You get the source as a string, you compile it to an in memory ... you load it and instantiate classes from it. ...
    (microsoft.public.dotnet.languages.csharp)