New Presentation(fileStream) Cloning


#1

Stream s = new MemoryStream(b);

p = new Presentation(s);

The new Presentation call is very expensive and takes about 3 seconds. I would like to cache the presentation in memory after construction. This cached presentation would be the model to be used on each of the other presentations to be created. Currently, I simply have a pointer to the actual object in cache and making changes to the object therefor reflects on the cached template.

Is there a way to clone the template in memory so it may be used as a model for each further generation?

-Mike


#2

3 seconds is too long. Is it a large presentation template or you calculated this time in the debugger?

Cloning of template in the memory is possible just through serialization and
it will take much more time than one more “new Presentation” call.
Storing cached template in the memory is a right way but why you change it?
I think you should make some changes in the app logic and don’t touch objects on the template’s slides.