|
Hi, we're trying to replace our OLE compound file based image data storage with XPS documents. One file contains 1-10000 bitmaps with a total size of up to several GBs.. With OLE compound files we got a data write rate of about 30 MB/s (on a reference machine). Using XPS document I can't get more than 6 MB/s . Turning off compression doesn't speed things up.
My questions are: - What causes this - factor 5 - overhead ? - Is XPS the right technology for this application ?.
Her's the source code for the write - loop
using (XpsDocument document = new XpsDocument(destFileName, FileAccess.ReadWrite, CompressionOption.SuperFast)) {
IXpsFixedDocumentSequenceWriter docSeqWriter = document.AddFixedDocumentSequence(); IXpsFixedDocumentWriter docWriter = docSeqWriter.AddFixedDocument(); IXpsFixedPageWriter pageWriter = docWriter.AddFixedPage(); using (FileStream sourceStream = new FileStream(textImageName.Text, FileMode.Open)) { int numtimes = int.Parse(textNumTimes.Text); for (int i = 0; i < numtimes; i++) { XpsImage img = pageWriter.AddImage("image/jpeg"); Stream imgStream = img.GetStream(); sourceStream.Seek(0, SeekOrigin.Begin); CopyStream(sourceStream, imgStream); img.Commit(); } pageWriter.Commit(); document.Close(); }
Wolfgang B. |