Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 DEV-Group
 DEV Bug Reports (Closed)
 ADJUST (all): minimize includes to function
 Forum Locked  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

Kerry
Average Member

USA
553 Posts

Posted - 29 January 2001 :  17:12:44  Show Profile  Visit Kerry's Homepage
Has anyone noted any good performance advantages of using includes? Certainly they allow for a certain amount of portability / reusability of code, but can they help / hinder perfomance significatly?

Example:

<% if myVAR = "x" then %>
<!-------BIG WHOPPIN INCLUDE FILE---------->
<% end if %>

...or
 
<% if myVAR = "x" then
response.write"Here's where we'll actually put 1200 lines of code"
end if
%>


One line of thought tell me they'd perform about the same, another reasons that the first example would be faster (if myVAR = "y" or something other than X) because the 1200 lines wouldn't be looked at at all while the other method would still need to read through line-by-line.

Or am I over simplifying?

Thanks in advance,
-Kerry

moved by reinsnitz on 03/14/2001

Doug G
Support Moderator

USA
6493 Posts

Posted - 29 January 2001 :  20:53:37  Show Profile
quote:
One line of thought tell me they'd perform about the same, another reasons that the first example would be faster (if myVAR = "y" or something other than X) because the 1200 lines wouldn't be looked at at all while the other method would still need to read through line-by-line.

Change your thinking. The only difference between the two examples is that the raw source code comes from one file in the first case and two files in the second case. The entire code is assembled before any preprocessing takes place, so the net result is the ASP processor looks at identical code.

Performance generally isn't the motivation to use include files, rather non-redundancy is the issue. Typically include files contain non page-specific code so only one copy needs to be maintained. Imagine life with 100 asp pages using the same big whoppin include file and you need to make some code changes to whatever is inside the include. Now imagine life if the actual code is embedded 100 different times in 100 different files.


======
Doug G
======
Go to Top of Page

Kerry
Average Member

USA
553 Posts

Posted - 29 January 2001 :  21:57:27  Show Profile  Visit Kerry's Homepage
Thinking adjusted. -Thanks Doug

-Kerry

Go to Top of Page

work mule
Senior Member

USA
1358 Posts

Posted - 29 January 2001 :  23:00:48  Show Profile
I think Doug hit it right on the head when he said "non-redundancy is the issue".

One point I'd like to bring up is the practice of including the same file multiple times. I don't know if having the same include statement 5 times means that the server will load 5 copies of it or not. (I think it does.)

There are a couple of pages that include the same file multiple times. I did a search of all the Snitz .asp files for the include inc_footer.asp code and found 119 occurrences in 51 files. The worst offender is post_info.asp which includes inc_footer.asp 45 times.

%>
<!--#INCLUDE FILE="inc_footer.asp" -->
<%


Regardless of how many copies of the inc_footer.asp are loaded, the other thing to note that everytime you do this, there is a matter of the asp-html context switching too.

Would this work better wrapped into a sub? Replace all the instances of the above with something like a Call Footer() statement?


Sub Footer()
%>
<!--#INCLUDE FILE="inc_footer.asp" -->
<%
End Sub


Just something to think about.

Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 30 January 2001 :  01:34:16  Show Profile
quote:
Would this work better wrapped into a sub? Replace all the instances of the above with something like a Call Footer() statement?

Yes, yes it would. I know the many inc_footers has been brought up in the past, and it's not a good thing to do. You are correct, each include loads another copy so the code is redundantly included those many times, which does create a significant impact on the server cache memory.

======
Doug G
======
Go to Top of Page

RichardKinser
Snitz Forums Admin

USA
16655 Posts

Posted - 30 January 2001 :  02:10:39  Show Profile
I think this has been brought up before (at least I think I remember something about it)

In post_info.asp the <!--#INCLUDE FILE="inc_footer.asp" --> that are immediately after a line that includes Go_Result can be deleted.

The Go_Result sub outputs the message and already includes the <!--#INCLUDE FILE="inc_footer.asp" --> so it's just redundant.
Go to Top of Page

HuwR
Forum Admin

United Kingdom
20584 Posts

Posted - 30 January 2001 :  05:31:02  Show Profile  Visit HuwR's Homepage
maybe we should bump this to bugs then, to have them sorted out in the forum code.

'Resistance is futile'
Go to Top of Page

Reinsnitz
Snitz Forums Admin

USA
3545 Posts

Posted - 15 March 2001 :  10:15:03  Show Profile  Visit Reinsnitz's Homepage  Send Reinsnitz an AOL message  Send Reinsnitz an ICQ Message  Send Reinsnitz a Yahoo! Message
continue discussion Here.

Reinsnitz (Mike)
><)))'> Need a Mod?
"Therefore go and make disciples of all nations,..." Matthew 28:19a
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.12 seconds. Powered By: Snitz Forums 2000 Version 3.4.07