[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Re: reverse() template (Was: RE: XSL output method

Subject: Re: Re: reverse() template (Was: RE: XSL output method="text" and indent preservation)
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Sat, 4 Aug 2001 05:06:47 -0700 (PDT)
xml xslt reverse output
Francis Norton wrote:

> Dimitre Novatchev wrote:
> > 
> > 
> > Here are two templates for reversing a string. The first is much faster and more
> > straightforward, the second will almost never cause an XSLT processor to crash
due
> > to deep recursive processing (it has a maximum recursion depth of only 20 for
> > reversing a 1MB long string):
> > 
> 
> A logarithmic decrease in stack depth, very nice. How great is the
> difference in performance?


Surprisingly enough, the "least recursive" version fares pretty well -- I expected
it to be grossly inefficient, but this isn't the case.

I compared the speed of the two kinds of transformations on an 350MHz 64MB RAM
Pentium, doubling the string length from 100 to 3200.

Here are the results in milliseconds:

Length        Simple        Least Recursive
-------------------------------------------
 100              37                    58
 200              85                   117
 400             199                   235
 800             522                   469
1600            1460                   927
3200           35000                  1870


I can explain the extremely large times for the first algorithm with the inefficient
way MSXML3 handles recursion -- most probably virtual memory had to be used and most
probably there was trashing.

Otherwise both algorithms must be almost linear, the second one a little bit more
complex.

Cheers,
Dimitre Novatchev.

__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/

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


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.