RE: [PHP] Newbie Question on Efficiency : Follow-up Question
Exactly- I could see uses in PHP, but they're so limited that it's obvious to see why it works the way it does. Michael Kennedy -Original Message- From: Martin Towell [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 10:46 PM To: '[EMAIL PROTECTED]'; [EMAIL PROTECTED] Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question The only reason a compiled language would not include a function/module/etc is to reduce the size of the final executable. Since php doesn't store (barring the caching engines, but they work differently anyway) a compiled version, it doesn't need to worry about not including something. Martin -Original Message- From: Michael Kennedy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 17, 2002 1:36 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question Yeah, that's what I figured. With C++ you could find evidence that it only grabbed the used portions, but in PHP I didn't see anything to support that. Of course, like I said, the answer likely wouldn't have made a difference in anything I did, but it's nice to delve a little deeper sometimes. Thanks. Michael -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 8:05 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question PHP loads everything up before it starts doing anything. It's only going to execute the code it needs to, though, of course. I asked this question a while ago and got that answer. The process of loading all of the code is minimal, though, compared the actually executing the code. ---John Holmes... > -Original Message- > From: Michael Kennedy [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 7:26 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question > > OK, if I understand C++ correctly, if I write a program and #include > or something similar and compile the program it only > compiles with the used functions in it, right? So, if I never use 'cin' > it leaves that function out of the final complied app. > > Does/can PHP do anything similar? I'm always much more comfortable with > a language when I can understand how it works and I'm sure some of you > feel the same. > > Now, I fully understand that PHP documents are not even close to being > compiled in the traditional sense. But, I'm wondering if it pulls all > the necessary functions into memory when the page is accessed, then uses > them when needed, or does it pull the whole include()d file into memory > and just combine the whole mess together into one big memory heap and > run like that? > > My gut tells me that it's the second one, but I'm just wanting to be > sure. Of course, the answer likely won't make a single difference in my > life, but I'm just curious... Also, I hope the above question isn't > stupid. I do have a habit of thinking about something for a while and > then having it suddenly hit me later that the answer is simple very > trivial. Ah, well... > > Thanks for humoring me. > Michael > > -Original Message- > From: Monty [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 5:44 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Newbie Question on Efficiency > > If you have have a large number of functions, it might be better to > separate > them into a few files that you can include as needed. I use one file > that > contains functions needed by every page. I have a few other files that > contain functions that aren't needed by every page, so, I include them > only > on pages that need them. But most functions go in the main include file > used > on every page. > > Separating them will also minimize some overhead if you have a lot of > functions. Otherwise, if your include files aren't War & Peace in > length, > one include file is fine. > > > >>>> [EMAIL PROTECTED] 07/16/02 04:59PM >>> > > Hello everyone, I'm a newbie and have a question on style that I've > not > > seen addressed anywhere. I have a large number of frequently used > > functions that I'm trying to find a good way to organize. The method > > I'm thinking of using is to simply create a .php file called, for > > example, functions.php. Then, just include the file at the top of > each > > page that needs any of the functions, and just call them as needed. > My > > question is this- if that file gets very large with tons of different > > functions, is that an inefficient method? I'm not entirely clear on > how > &g
RE: [PHP] Newbie Question on Efficiency : Follow-up Question
The only reason a compiled language would not include a function/module/etc is to reduce the size of the final executable. Since php doesn't store (barring the caching engines, but they work differently anyway) a compiled version, it doesn't need to worry about not including something. Martin -Original Message- From: Michael Kennedy [mailto:[EMAIL PROTECTED]] Sent: Wednesday, July 17, 2002 1:36 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question Yeah, that's what I figured. With C++ you could find evidence that it only grabbed the used portions, but in PHP I didn't see anything to support that. Of course, like I said, the answer likely wouldn't have made a difference in anything I did, but it's nice to delve a little deeper sometimes. Thanks. Michael -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 8:05 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question PHP loads everything up before it starts doing anything. It's only going to execute the code it needs to, though, of course. I asked this question a while ago and got that answer. The process of loading all of the code is minimal, though, compared the actually executing the code. ---John Holmes... > -Original Message- > From: Michael Kennedy [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 7:26 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question > > OK, if I understand C++ correctly, if I write a program and #include > or something similar and compile the program it only > compiles with the used functions in it, right? So, if I never use 'cin' > it leaves that function out of the final complied app. > > Does/can PHP do anything similar? I'm always much more comfortable with > a language when I can understand how it works and I'm sure some of you > feel the same. > > Now, I fully understand that PHP documents are not even close to being > compiled in the traditional sense. But, I'm wondering if it pulls all > the necessary functions into memory when the page is accessed, then uses > them when needed, or does it pull the whole include()d file into memory > and just combine the whole mess together into one big memory heap and > run like that? > > My gut tells me that it's the second one, but I'm just wanting to be > sure. Of course, the answer likely won't make a single difference in my > life, but I'm just curious... Also, I hope the above question isn't > stupid. I do have a habit of thinking about something for a while and > then having it suddenly hit me later that the answer is simple very > trivial. Ah, well... > > Thanks for humoring me. > Michael > > -Original Message- > From: Monty [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 5:44 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Newbie Question on Efficiency > > If you have have a large number of functions, it might be better to > separate > them into a few files that you can include as needed. I use one file > that > contains functions needed by every page. I have a few other files that > contain functions that aren't needed by every page, so, I include them > only > on pages that need them. But most functions go in the main include file > used > on every page. > > Separating them will also minimize some overhead if you have a lot of > functions. Otherwise, if your include files aren't War & Peace in > length, > one include file is fine. > > > >>>> [EMAIL PROTECTED] 07/16/02 04:59PM >>> > > Hello everyone, I'm a newbie and have a question on style that I've > not > > seen addressed anywhere. I have a large number of frequently used > > functions that I'm trying to find a good way to organize. The method > > I'm thinking of using is to simply create a .php file called, for > > example, functions.php. Then, just include the file at the top of > each > > page that needs any of the functions, and just call them as needed. > My > > question is this- if that file gets very large with tons of different > > functions, is that an inefficient method? I'm not entirely clear on > how > > PHP is parsed and passed to the client. I assume it would be best to > > divide up the functions into multiple files (ex. dbfunctions.php, > etc.), > > but is that still the best method? Basically, I'm just curious on how > > you guys handle things like this. > > > > Thanks in advance. > > Michael Kennedy > > > &g
RE: [PHP] Newbie Question on Efficiency : Follow-up Question
Yeah, that's what I figured. With C++ you could find evidence that it only grabbed the used portions, but in PHP I didn't see anything to support that. Of course, like I said, the answer likely wouldn't have made a difference in anything I did, but it's nice to delve a little deeper sometimes. Thanks. Michael -Original Message- From: John Holmes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 8:05 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question PHP loads everything up before it starts doing anything. It's only going to execute the code it needs to, though, of course. I asked this question a while ago and got that answer. The process of loading all of the code is minimal, though, compared the actually executing the code. ---John Holmes... > -Original Message- > From: Michael Kennedy [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 7:26 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question > > OK, if I understand C++ correctly, if I write a program and #include > or something similar and compile the program it only > compiles with the used functions in it, right? So, if I never use 'cin' > it leaves that function out of the final complied app. > > Does/can PHP do anything similar? I'm always much more comfortable with > a language when I can understand how it works and I'm sure some of you > feel the same. > > Now, I fully understand that PHP documents are not even close to being > compiled in the traditional sense. But, I'm wondering if it pulls all > the necessary functions into memory when the page is accessed, then uses > them when needed, or does it pull the whole include()d file into memory > and just combine the whole mess together into one big memory heap and > run like that? > > My gut tells me that it's the second one, but I'm just wanting to be > sure. Of course, the answer likely won't make a single difference in my > life, but I'm just curious... Also, I hope the above question isn't > stupid. I do have a habit of thinking about something for a while and > then having it suddenly hit me later that the answer is simple very > trivial. Ah, well... > > Thanks for humoring me. > Michael > > -Original Message- > From: Monty [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 5:44 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Newbie Question on Efficiency > > If you have have a large number of functions, it might be better to > separate > them into a few files that you can include as needed. I use one file > that > contains functions needed by every page. I have a few other files that > contain functions that aren't needed by every page, so, I include them > only > on pages that need them. But most functions go in the main include file > used > on every page. > > Separating them will also minimize some overhead if you have a lot of > functions. Otherwise, if your include files aren't War & Peace in > length, > one include file is fine. > > > >>>> [EMAIL PROTECTED] 07/16/02 04:59PM >>> > > Hello everyone, I'm a newbie and have a question on style that I've > not > > seen addressed anywhere. I have a large number of frequently used > > functions that I'm trying to find a good way to organize. The method > > I'm thinking of using is to simply create a .php file called, for > > example, functions.php. Then, just include the file at the top of > each > > page that needs any of the functions, and just call them as needed. > My > > question is this- if that file gets very large with tons of different > > functions, is that an inefficient method? I'm not entirely clear on > how > > PHP is parsed and passed to the client. I assume it would be best to > > divide up the functions into multiple files (ex. dbfunctions.php, > etc.), > > but is that still the best method? Basically, I'm just curious on how > > you guys handle things like this. > > > > Thanks in advance. > > Michael Kennedy > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question on Efficiency : Follow-up Question
On Tue, Jul 16, 2002 at 06:25:42PM -0500, Michael Kennedy wrote: > OK, if I understand C++ correctly, if I write a program and #include > or something similar and compile the program it only > compiles with the used functions in it, right? So, if I never use 'cin' > it leaves that function out of the final complied app. > > Does/can PHP do anything similar? Nope. Everything is brought into memory at compile time. Or at least that's the way I understood it to be. I suspect it's still the case. --Dan -- PHP classes that make web design easier SQL Solution | Layout Solution | Form Solution sqlsolution.info | layoutsolution.info | formsolution.info T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question on Efficiency : Follow-up Question
PHP loads everything up before it starts doing anything. It's only going to execute the code it needs to, though, of course. I asked this question a while ago and got that answer. The process of loading all of the code is minimal, though, compared the actually executing the code. ---John Holmes... > -Original Message- > From: Michael Kennedy [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 7:26 PM > To: [EMAIL PROTECTED] > Subject: RE: [PHP] Newbie Question on Efficiency : Follow-up Question > > OK, if I understand C++ correctly, if I write a program and #include > or something similar and compile the program it only > compiles with the used functions in it, right? So, if I never use 'cin' > it leaves that function out of the final complied app. > > Does/can PHP do anything similar? I'm always much more comfortable with > a language when I can understand how it works and I'm sure some of you > feel the same. > > Now, I fully understand that PHP documents are not even close to being > compiled in the traditional sense. But, I'm wondering if it pulls all > the necessary functions into memory when the page is accessed, then uses > them when needed, or does it pull the whole include()d file into memory > and just combine the whole mess together into one big memory heap and > run like that? > > My gut tells me that it's the second one, but I'm just wanting to be > sure. Of course, the answer likely won't make a single difference in my > life, but I'm just curious... Also, I hope the above question isn't > stupid. I do have a habit of thinking about something for a while and > then having it suddenly hit me later that the answer is simple very > trivial. Ah, well... > > Thanks for humoring me. > Michael > > -Original Message- > From: Monty [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, July 16, 2002 5:44 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Newbie Question on Efficiency > > If you have have a large number of functions, it might be better to > separate > them into a few files that you can include as needed. I use one file > that > contains functions needed by every page. I have a few other files that > contain functions that aren't needed by every page, so, I include them > only > on pages that need them. But most functions go in the main include file > used > on every page. > > Separating them will also minimize some overhead if you have a lot of > functions. Otherwise, if your include files aren't War & Peace in > length, > one include file is fine. > > > >>>> [EMAIL PROTECTED] 07/16/02 04:59PM >>> > > Hello everyone, I'm a newbie and have a question on style that I've > not > > seen addressed anywhere. I have a large number of frequently used > > functions that I'm trying to find a good way to organize. The method > > I'm thinking of using is to simply create a .php file called, for > > example, functions.php. Then, just include the file at the top of > each > > page that needs any of the functions, and just call them as needed. > My > > question is this- if that file gets very large with tons of different > > functions, is that an inefficient method? I'm not entirely clear on > how > > PHP is parsed and passed to the client. I assume it would be best to > > divide up the functions into multiple files (ex. dbfunctions.php, > etc.), > > but is that still the best method? Basically, I'm just curious on how > > you guys handle things like this. > > > > Thanks in advance. > > Michael Kennedy > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question on Efficiency : Follow-up Question
OK, if I understand C++ correctly, if I write a program and #include or something similar and compile the program it only compiles with the used functions in it, right? So, if I never use 'cin' it leaves that function out of the final complied app. Does/can PHP do anything similar? I'm always much more comfortable with a language when I can understand how it works and I'm sure some of you feel the same. Now, I fully understand that PHP documents are not even close to being compiled in the traditional sense. But, I'm wondering if it pulls all the necessary functions into memory when the page is accessed, then uses them when needed, or does it pull the whole include()d file into memory and just combine the whole mess together into one big memory heap and run like that? My gut tells me that it's the second one, but I'm just wanting to be sure. Of course, the answer likely won't make a single difference in my life, but I'm just curious... Also, I hope the above question isn't stupid. I do have a habit of thinking about something for a while and then having it suddenly hit me later that the answer is simple very trivial. Ah, well... Thanks for humoring me. Michael -Original Message- From: Monty [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 5:44 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Newbie Question on Efficiency If you have have a large number of functions, it might be better to separate them into a few files that you can include as needed. I use one file that contains functions needed by every page. I have a few other files that contain functions that aren't needed by every page, so, I include them only on pages that need them. But most functions go in the main include file used on every page. Separating them will also minimize some overhead if you have a lot of functions. Otherwise, if your include files aren't War & Peace in length, one include file is fine. >>>> [EMAIL PROTECTED] 07/16/02 04:59PM >>> > Hello everyone, I'm a newbie and have a question on style that I've not > seen addressed anywhere. I have a large number of frequently used > functions that I'm trying to find a good way to organize. The method > I'm thinking of using is to simply create a .php file called, for > example, functions.php. Then, just include the file at the top of each > page that needs any of the functions, and just call them as needed. My > question is this- if that file gets very large with tons of different > functions, is that an inefficient method? I'm not entirely clear on how > PHP is parsed and passed to the client. I assume it would be best to > divide up the functions into multiple files (ex. dbfunctions.php, etc.), > but is that still the best method? Basically, I'm just curious on how > you guys handle things like this. > > Thanks in advance. > Michael Kennedy > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question on Efficiency
If you have have a large number of functions, it might be better to separate them into a few files that you can include as needed. I use one file that contains functions needed by every page. I have a few other files that contain functions that aren't needed by every page, so, I include them only on pages that need them. But most functions go in the main include file used on every page. Separating them will also minimize some overhead if you have a lot of functions. Otherwise, if your include files aren't War & Peace in length, one include file is fine. [EMAIL PROTECTED] 07/16/02 04:59PM >>> > Hello everyone, I'm a newbie and have a question on style that I've not > seen addressed anywhere. I have a large number of frequently used > functions that I'm trying to find a good way to organize. The method > I'm thinking of using is to simply create a .php file called, for > example, functions.php. Then, just include the file at the top of each > page that needs any of the functions, and just call them as needed. My > question is this- if that file gets very large with tons of different > functions, is that an inefficient method? I'm not entirely clear on how > PHP is parsed and passed to the client. I assume it would be best to > divide up the functions into multiple files (ex. dbfunctions.php, etc.), > but is that still the best method? Basically, I'm just curious on how > you guys handle things like this. > > Thanks in advance. > Michael Kennedy > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Newbie Question on Efficiency
Yeah, that's what I was thinking. Mostly I was curious if the procedure I mentioned was a good one or if there was something better to be doing. Thanks for the super quick reply. :) Michael -Original Message- From: Martin Clifford [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 16, 2002 4:01 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] Newbie Question on Efficiency Unless the file is getting retartedly big (10-20K), then I wouldn't separate them. Though if you have enough functions, you could justify making separate files for your database functions, output functions, backend functions, etc. Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ >>> [EMAIL PROTECTED] 07/16/02 04:59PM >>> Hello everyone, I'm a newbie and have a question on style that I've not seen addressed anywhere. I have a large number of frequently used functions that I'm trying to find a good way to organize. The method I'm thinking of using is to simply create a .php file called, for example, functions.php. Then, just include the file at the top of each page that needs any of the functions, and just call them as needed. My question is this- if that file gets very large with tons of different functions, is that an inefficient method? I'm not entirely clear on how PHP is parsed and passed to the client. I assume it would be best to divide up the functions into multiple files (ex. dbfunctions.php, etc.), but is that still the best method? Basically, I'm just curious on how you guys handle things like this. Thanks in advance. Michael Kennedy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Question on Efficiency
Unless the file is getting retartedly big (10-20K), then I wouldn't separate them. Though if you have enough functions, you could justify making separate files for your database functions, output functions, backend functions, etc. Martin Clifford Homepage: http://www.completesource.net Developer's Forums: http://www.completesource.net/forums/ >>> [EMAIL PROTECTED] 07/16/02 04:59PM >>> Hello everyone, I'm a newbie and have a question on style that I've not seen addressed anywhere. I have a large number of frequently used functions that I'm trying to find a good way to organize. The method I'm thinking of using is to simply create a .php file called, for example, functions.php. Then, just include the file at the top of each page that needs any of the functions, and just call them as needed. My question is this- if that file gets very large with tons of different functions, is that an inefficient method? I'm not entirely clear on how PHP is parsed and passed to the client. I assume it would be best to divide up the functions into multiple files (ex. dbfunctions.php, etc.), but is that still the best method? Basically, I'm just curious on how you guys handle things like this. Thanks in advance. Michael Kennedy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Newbie Question on Efficiency
Hello everyone, I'm a newbie and have a question on style that I've not seen addressed anywhere. I have a large number of frequently used functions that I'm trying to find a good way to organize. The method I'm thinking of using is to simply create a .php file called, for example, functions.php. Then, just include the file at the top of each page that needs any of the functions, and just call them as needed. My question is this- if that file gets very large with tons of different functions, is that an inefficient method? I'm not entirely clear on how PHP is parsed and passed to the client. I assume it would be best to divide up the functions into multiple files (ex. dbfunctions.php, etc.), but is that still the best method? Basically, I'm just curious on how you guys handle things like this. Thanks in advance. Michael Kennedy