First off... Been using Snitz for a while and love it.
But I have a question:
I was looking over the code for Snitz and was wondering why everything is written out using Response.Write statements instead of escaping out of ASP script.
i.e.
... Response.Write "some text" ...
instead of
... %> some text <% ...
Escaping from ASP script is about twice as fast as using Response.Write.
quote:Originally posted by brandonh6k Escaping from ASP script is about twice as fast as using Response.Write.
That depends on the version of ASP.
And also how much you're switching in and out. If you do it as much as we do here on the forums, the speed change is negligible (versions prior to 3.4 did context switching)
Under the stress testing I did a while back even heavy switching came out 20% or so faster actually Dave, having said that YMMV with each application I guess.
I think its hard for people to get out of the habbit as well, for ages we were told best practice was to reduce context switching, unfortunately now the opposite is true but people are still kinda "stuck in their ways" even when it can be demonstrated that switching has performance benefits.
The trick is to really separate out as much of your display logic from your processing logic as possible. Do all the ASP work at the top of the page and assign the results to variables this way most of the time your context switching then involves little more than a <% = VariableName %> here and there between your HTML, sure there are times when this just won't do though but theres still ways around having convoluted if/then/else structures sitting right in the middle of a bunch of HTML.