into CFMX scripts.
So far it looks promising -- Most Perl structure, syntax & RegExps
convert quite easily to CFScript.
There are still a few disadvantages to CFMX over Perl
1) CF lacks a file readLn (readLine), so you must read in the entire
file into memory. You then can approximate a Perl chomp (readLn) by CF
list-looping over the file with a newline delimiter. Note: Using CF
list-looping presents the next line with each iteration and performs
well (ListGetAt() is too slow to be acceptable).
2) Perl maintains a pointer to the current line position in a file --
this means you can chomp (readLn) the file in subroutines, then return
to the caller with the current line positioned where the subroutine
left it. CF list-looping has no similar construct, nor the ability to
list-loop from-to -- this means that the logic of the main routine gets
more complex and there is more main-subroutine overhead.
For example the xml file is divided into two major sections: tracks
followed by playlists.
The Perl program chomps till it finds the first track
----passes control to a get_tracks subroutine
------subroutine chomps tracks until first play list, then returns
Main program passes control to get_playlists subroutine
------subroutine chomps playlists until EOF, then returns
Main program continues
In the CF program
Main Program loops over the list line by line.
if found first track and not first playlist
---call get_tracks sub to process this track (line) only & return
if found first playlist
---call get_playlist sub to process this playlist (line) only & return
Main program continues
As you can see, there is additional testing and call overhead for each
line in the CF solution -- all because CF can't readLn a file nor
manipulate the list-loop position in a subroutine.
For the latter I would like to see CFML improved to include:
1) an implied list pointer for each list loop:
1) , ListGetFirst, ListGetLast, ListGetAt functions that reposition the
list pointer
Also cf list-loop with from and to parameters
Also CFFile readln
Dick
On Jun 15, 2004, at 3:29 PM, I-Lin Kuo wrote:
> While I love XSLT, I have encountered similar problems
> using XSLT on large xml files (~25meg). The problem is
> that all the XSLT engines I know load the entire
> document into memory before performing the
> transformation. At first I cut up the large files by
> hand into two or three pieces so they could be
> processed by XSLT, but that was just too much of a
> pain. I found that by first processing the file
> line-by-line using sed, I could remove a lot of the
> unneeded attributes. The resultant xml could then be
> run through my XSLT engine without having to break it
> apart. Hope this helps.
>
> --- Dick Applebaum <[EMAIL PROTECTED]> wrote:
> > On Jun 14, 2004, at 7:17 AM, Dave Watts wrote:
> >
> > >��That's a lot of data to output to a browser.
> > Where exactly is it
> > > failing? On
> > >��the CFFILE, the XmlTransform function, or the
> > CFOUTPUT?
> > >
> >
> > That's the size of the entire file (3400 songs & 30
> > playlists) -- all
> > of it is not outputted to the browser -- only 10
> > playlists and selected
> > info for each song in the playlist about 150 songs
> > total.
> >
> > There is one playlist that contains every song in
> > the library -- i want
> > to exclude it and any of the 3400 songs not in the
> > target playlists
> >
> > What I really wanted to do was read the song file
> > into a cf prog,
> > extract selected playlists. and the songs for the
> > lists, then output
> > the whole thing as follows:
> >
> > Playlist
> >���song title---artist---duration
> >���song title---artist---duration
> >���song title---artist---duration
> >�����*
> >�����*
> > Playlist
> >���song title---artist---duration
> >���song title---artist---duration
> >���song title---artist---duration
> >�����*
> >�����*
> >
> > The song title would be a link to the actual song
> > file
> >
> > So the max output would be about 150 rows of 3
> > columns��(and I could
> > page/cache that, if needed)
> >
> > Rob put together a xls style sheet & i figured how
> > use it to do a
> > transform in the cf prog.
> >
> > But, I wonder if it wouldn't be more efficient to
> > parse the xml file
> > myself, and extract the playlists & songs I need.
> >
> > I would think that a compiled, byte code, cf app
> > would be more
> > efficient than an interpretive transform of a text
> > xsl file against a
> > text xml file.
> >
> > Because the xml file is so large��and contains so
> > much extraneous (to
> > this app) information and verbose tags, I even
> > thought of parsing the
> > file myself with regexp.
> >
> > Dick
> >
> >
> > "Seek simplicity, and distrust it."
> > - Alfred North Whitehead -
> >
> >
> >
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

