[xsl] Re: Re: exponential math functions in xslt

Subject: [xsl] Re: Re: exponential math functions in xslt
From: Dimitre Novatchev <dnovatchev@xxxxxxxxx>
Date: Fri, 20 Sep 2002 05:03:08 -0700 (PDT)
--- Trevor Nash <tcn at melvaig dot co dot uk> wrote:

 
> On Thu, 19 Sep 2002 12:27:53 -0700 (PDT), Dimitri wrote:
> 
> >As for another myth -- that extension functions are significantly
> >faster, I recently performed detailed timing in an XSLT application,
> in
> >which ln() was computed approx. 5000 times. Substitution of the FXSL
> >"ln" template with calls to a Javascript extension function led to
> less
> >than 10% increase of the speed.
> 
> Why did you pick Javascript?
> 
> The numbers for a Java (not Javascript) extension called from a Java
> based XSLT processor are likely to be different.

Allow me to disagree with this. The Javascript extension does nothing
else but call the standard math.log()

And the math object itself will hardly be implemented in Javascript.
Therefore, there's no reason why Javascript's math.log() would perform
slower than its any other language counterpart.


> 
> I agree though that for the majority of stylesheets the difference
> between using an extension and a ready written XSLT library such as
> FXSL is not worth bothering about for performance reasons.  There
> might be implications with regard to testing and validation though.

Absolutely right! A mixture of stylesheet modules and extension
functions is much more difficult to debug and maintain than a pure XSLT
solution. 

Not to speak that using extension functions is contradictory to the
spirit of a functional language, has often dangerous and unpredictable
side effects and,  if possible, is best to be avoided.

In addidtion to this, debugging becomes much more easy and
straightforward when one uses FXSL, mainly due to the higher level of
abstraction and the compactness of the functional style.

And as we all know, it is much more easy even to prove the correctness
of an implementation, written in a functional language (in this case
there's nothing to debug... :o)   ).

In my experience, it is best first to provide a solution in Haskell,
then the translation to XSLT is almost always straightforward and
unproblematic.

The Haskell code itself is best put in comments preceding its relevant
XSLT translation and provides the perfect documentation there could be.




=====
Cheers,

Dimitre Novatchev.
http://fxsl.sourceforge.net/ -- the home of FXSL

__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

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


Current Thread