[xsl] Writing to file vs. storing in a variable

Subject: [xsl] Writing to file vs. storing in a variable
From: mjyoungblut@xxxxxxx
Date: Tue, 23 Oct 2001 08:35:50 -0500
I have been an XSL file that compares two files.
There are three main steps:
     1. Compare the two files and store the results in a variable
     2. Use the variable to create a header in output File A
     3. Write the contents of the variable to output File A

I have been using large XML files for the comparison, and the memory
consumption is pretty large.  It is manageable, but if a couple are running
at the same time, running out of memory is definitely a possibility.  It
finally dawned upon me(I am a little slow) that I could break the XSL file
up into three parts:
     1. Compare the two files, writing the results immediately to File A
     2. Read up File A(much smaller than the originals), writing the header
to File B
     3. Copy the contents of  File A to File B

This approach cut down on memory consumption quite a bit.

The problem is that the first part of the second approach takes about 50%
LONGER than all of the steps in the first approach.  I have tried using
Saxon and Xalan, and they are pretty equivalent(other than Xalan being a
big memory hog).

Can anybody explain to me why this would be the case?

Thank you,
     Matt Youngblut




 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread