Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Query Times vs. JS
What kind of difference would one be looking at for these kinds of calls/scripts? Timewise?
The original: (from a form)
<li <txp:zem_nth step=1 of=2>class="odd"</txp:zem_nth>>
<p class="post-date"><txp:posted format="%b/%d/%y" /></p>
<h3 class="post-title"><txp:permlink><txp:title /></txp:permlink></h3>
</li>
The new: also in a form:
<li>
<p class="post-date"><txp:posted format="%b/%d/%y" /></p>
<h3 class="post-title"><txp:permlink><txp:title /></txp:permlink></h3>
</li>
With this in the head:
<script type="text/javascript">
// <![CDATA[
$(document).ready(function() {
$("ul#tag-list li:nth-child(odd)").addClass("odd");
});
// ]]>
</script>
Last edited by ma_smith (2007-04-10 02:17:44)
- I am Squared Eye and I
am launchinghave launched Pattern Tap
Offline
Re: Query Times vs. JS
Personally, I would go with JS for cleaner source code. Timewise, I don’t know…but Safari can give you an idea. Not sure how much it helps, but here are the instructions:
- enable the debug menu
- Relaunch and make sure there are no tabs open, or else you’ll get a bizarre error message
- ⌘\ (Debug>Show Page Load Test Window)
- switch “Suite” to “URL”
- Enter URL and click start
It might be more precise to test locally too.
As an aside, I would definitely gzip the jQuery library though, since it gains more weight everyday (whatever happened to 16kb?!). Place this at the top of your jquery file (save as .php):
<?php
//http://fiftyfoureleven.com/weblog/web-development/css/the-definitive-css-gzip-method
ob_start ("ob_gzhandler");
header("Content-type: text/javascript; charset: UTF-8");
header("Cache-Control: must-revalidate");
$offset = 60 * 60 ;
$ExpStr = "Expires: " .
gmdate("D, d M Y H:i:s",
time() + $offset) . " GMT";
header($ExpStr);
?>
edit: added some images
Last edited by jm (2007-04-10 04:46:03)
Offline
#3 2007-04-10 17:55:43
- Mary
- Sock Enthusiast
- Registered: 2004-06-27
- Posts: 6,236
Re: Query Times vs. JS
http://forum.textpattern.com/viewtopic.php?id=21996
I’ve closed the other one.
Offline
#4 2007-04-10 22:10:10
- zem
- Developer Emeritus
- From: Melbourne, Australia
- Registered: 2004-04-08
- Posts: 2,579
Re: Query Times vs. JS
What kind of difference would one be looking at for these kinds of calls/scripts? Timewise?
Textpattern’s ‘Runtime’ output (bottom of page source in Testing mode) will give you a good indication of the the time spent on the server side.
I’d wager that the difference between the two is insignificant on average. Usually the slowest thing on a Textpattern page is the article list tag, which would be the same in both cases. Tags like zem_nth take no time at all compared with tags that perform database queries.
Alex
Offline
Re: Query Times vs. JS
All,
thx. This was more an exercise in learning about queries, php, js etc. Very informative. Thnx. Also, Mary. Sorry about the double post. I’ve had that happen twice recently. I’ll look into it.
M
- I am Squared Eye and I
am launchinghave launched Pattern Tap
Offline
Pages: 1