RE: Performance -- Re: [xsl] RE:"*NEVER* use for-each"

Subject: RE: Performance -- Re: [xsl] RE:"*NEVER* use for-each"
From: "Patrick, Curtis W" <curtis.patrick@xxxxxxx>
Date: Tue, 27 Feb 2001 15:47:10 -0600
To put performance concerns as the very last issue is ridiculous and
exhibits extremely poor judgment.  It is a pity that you must have been
burned so badly on a project that you have decided to take the completely
opposing view.  To use the space shuttle as an example is ludicrous and off
the mark.  

Optimizations and response times are important.  So someone has developed
this incredible architecture.  Perfect for say, the banking industry.  MBNA
is sold on this incredibly brilliant architecture. Simple to install (good
work!), extendable (you can add new banks as MBNA acquires them without
converting them to MBNA core system, BRILLIANT!), reusable (always good),
reuse (oops, repeated yourself), etc.  Good job.

But wait, the ingenious design failed to address response times.  The
modular design requires too many round trips between an ATM and the core
system.  Perhaps someone failed to identify the priority for ATM request.
MBNA looses customers because their ATMs take too long.

The need for speed and optimizations are not limited to satellites, space
stations, or air defense systems.  Imagine how pathetic the OS or processor
that you are currently using would be if the designers weren't just as
concerned with speed and response times as they were with module and
reusability issues.

Please note that the use of "for-each" is not a design requirement, but
rather an implementation detail.  Perhaps that misunderstanding was the root
of your earlier project failures.

Curtis 

-----Original Message-----
From: Anjul Srivastava [mailto:anjul@xxxxxxxxxxx]
Sent: Tuesday, February 27, 2001 2:39 PM
To: xsl-list@xxxxxxxxxxxxxxxxxxxxxx
Subject: Performance -- Re: [xsl] RE:"*NEVER* use for-each"


> In this age of huge storage devices, ridiculously fast machines, and
bloated
> OSes, the art of optimization is dwindling.  People just don't get how
> important optimizing for speed can be.  In my case, I MUST be concerned
with
> speed and size and will likely use a for-each (if I see a gain in testing)
> over the "correct" method of using templates.  Response time is that
> important.

I have seen far too many projects being ruined because somebody chose one
design over the other because of O(1) performance issues. Unless you are
programming the space shuttle, O(1) performance comes LAST, and definitely
not at the design stage. At the design stage the concerns are: reduction of
complexity (implementation ease), extensibility, reusability, reuse, etc.
Even individually, each of these concerns overrides O(1) performance
considerations, not to talk of all of them put together.

O(1) Performance comes last. When you have successfully developed a product
that has made it through the QA cycle, profile  your code and look at your
hot spots. Then see how can you minimally modify your elegant design to
speed up the hot spots. Maybe it might lead you to make your design even
more elegant, but then, probably it won't. But wait, don't go make those
changes yet. Get feedback from your users. Are they finding it slow? Or
would they much rather have you put in your hard work into implementing that
cool feature that didn't make it into this version?

Okay I went back and put O(1) in front of each instance of the performance
work above. Firstly, O(1) performance enhancements are (loosely speaking)
those that improve performance by the same percentage for both large input
and very large input. The advantage of using classes in C++/Java rather than
writing everything in main falls under this category. So does the
performance difference (if any) between xsl:templates and xsl:for-each. A
performance improvements that are not O(1) is using a binary tree instead of
a list to store data that is looked up significantly often.

Usually an intelligent designer will either create an abstract design that
lets you plug in containers of your choice, or he will be able to anticipate
and thus incorporate efficient (in the order sense) containers into his
design up front. Somehow I can't imagine a designer thinking, "Gee, how
would I store the US yellow pages, hmmm.. I think I'll just use a linked
list".

In short, whether or not you use "for-each" should depend upon
non-performance factors, (unless of course you are writing a stylesheet for
use in the spaceshuttle that must be applied within the first three seconds
of reentry).


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

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


Current Thread