Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Re: XSLT vs Templating, Part 2

by Masem (Monsignor)
on Feb 07, 2002 at 19:46 UTC ( [id://143954]=note: print w/replies, xml ) Need Help??


in reply to Re: XSLT vs Templating, Part 2
in thread XSLT vs Templating, Part 2

I agree, in general you'd use these, but to be fair to XML::Generator::DBI, which to the best of my knowledge you cannot take advantage of these features, I kept them off. Given the baseline performance of the DBI/print system, which did fifty iters without blinking, I would suspect these tricks would only slighty improve the non-XML systems (which all were faster to start with).

-----------------------------------------------------
Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
"I can see my house from here!"
It's not what you know, but knowing how to find it if you don't know that's important

Replies are listed 'Best First'.
Re: Re: Re: XSLT vs Templating, Part 2
by Matts (Deacon) on Feb 07, 2002 at 21:16 UTC
    Actually I just uploaded 0.02 of XML::Generator::DBI to CPAN, which can take a prepared statement instead of as string as a parameter to execute(). And it already did the bind_columns trick. It also now makes Indent off the default, so it should be about as fast as I can make it.

    The other thing I did was change your '//monks' in your XSLT to just 'monks', which is much faster, since it doesn't examine every single child node.

Re: Re: Re: XSLT vs Templating, Part 2
by perrin (Chancellor) on Feb 07, 2002 at 19:53 UTC
    Technically, you could do the XML side of things without XML::Generator::DBI, and it would be faster since you could code if for your specific case rather than making a general DBI-->XML tool. Then you could take full advantage of all DBI speed tweaks. However, you would probably end up writing a lot more code.

    When comparing performance, I do think that being unable to fully use DBI's performance features matters. Personally though, I would be more interested in knowing how easy it is to code the different approaches, since they all seem to perform well enough.

      Even without some of the additional test cases that I think I'll add tonight as suggested by Matts and gellyfish, I think my example demonstrates the apprear of code that tries to separate presentation and content. The DBI/print and DBI/CGI solutions are fast, but ugly, IMO (even slicking up the CGI with a map, it's still ugly). All the template and XSLT solutions, on the other hand, have no hint of presentation in the code, and that is all delegated to separate files. Mind you, since TT2 appears to be limited in handling of pure XML data (given the poor speed), you may have to do some massaging of data to get it ready for passing to TT2 as I had to do (the join oneliner).

      Of course, when you then turn to the template files or stylesheets, you may be scared by either one. One thing, though I want to use XSTL, is that unless you are using a editor that can make it easy to distinquish between the XSL directives and the XHTML markup, it might be hard to determine the difference between what's what in the stylesheet; on the other hand, the template specific code is easy to pick out from the [% %] blocks. But these differences may be simply personal opinion; some might find anything XML-based easy to read, and find the template solution to be tag-soup ( As an aside, I see that in TT2 2.06, if not earlier, you can specify which tags TT2 will look for, including using SGML comments <!-- --> as delimiters.)

      However, I suspect the real test will come when I start putting together other parts of a CGI system I'm working on, such that I run through multiple XSLT transformations. This *should* be as easy as chaining the results one after another, but....

      -----------------------------------------------------
      Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
      "I can see my house from here!"
      It's not what you know, but knowing how to find it if you don't know that's important

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://143954]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (7)
As of 2024-03-19 03:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found