speed of require/include

speed of require/include

am 20.10.2010 22:50:31 von Tommy Pham

Hi everyone,

I think this question is general PHP but because I'm using Windows for
development at the moment and was wondering if it's related to Windows.
Does the speed of require/require_once/include/include_once depends on disk
activity, buffers (disks, controller, Windows)? I can't seem to get steady
time from xdebug profile... it varies from 27ms to 170ms on one of my
scripts while another script in the same framework with less require/include
always have a steady ~6.5ms (the previous has 30 requires/includes and the
latter has 8 requires/includes). I only have the skeleton of the framework
for my project (no DB access, no fancy html/xml output). I'm running PHP
5.3.3 FastCGI on Windows 2008 R2 x64 w/ 4GB RAM. SATA RAID controller is
3ware 9650se.

Thanks for your time,
Tommy


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: speed of require/include

am 20.10.2010 23:05:24 von Michael Tacelosky

--20cf303dd2aca44b66049312c494
Content-Type: text/plain; charset=ISO-8859-1

If you have the RAM, install php_apc -- once the scripts are included once,
the tokenized php will be cached in memory, can be a significant performance
boost.

We also use it for "global" variables that don't change across scripts, such
as state and country names. Great tool, I wish it were built into PHP
instead of a pecl module.

Tac

On Wed, Oct 20, 2010 at 4:50 PM, Tommy Pham wrote:

> Hi everyone,
>
> I think this question is general PHP but because I'm using Windows for
> development at the moment and was wondering if it's related to Windows.
> Does the speed of require/require_once/include/include_once depends on disk
> activity, buffers (disks, controller, Windows)? I can't seem to get steady
> time from xdebug profile... it varies from 27ms to 170ms on one of my
> scripts while another script in the same framework with less
> require/include
> always have a steady ~6.5ms (the previous has 30 requires/includes and the
> latter has 8 requires/includes). I only have the skeleton of the framework
> for my project (no DB access, no fancy html/xml output). I'm running PHP
> 5.3.3 FastCGI on Windows 2008 R2 x64 w/ 4GB RAM. SATA RAID controller is
> 3ware 9650se.
>
> Thanks for your time,
> Tommy
>
>
> --
> PHP Windows Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Please note my new phone number: (202) 656-7822

--20cf303dd2aca44b66049312c494--

RE: speed of require/include

am 20.10.2010 23:08:51 von Keith Davis

Or use Wincache. That's what we are using. Runs like a champ.

Keith Davis (214) 906-5183


-----Original Message-----
From: Tac Tacelosky [mailto:tacman@gmail.com]
Sent: Wednesday, October 20, 2010 4:05 PM
To: Tommy Pham
Cc: php-windows
Subject: Re: [PHP-WIN] speed of require/include

If you have the RAM, install php_apc -- once the scripts are included
once, the tokenized php will be cached in memory, can be a significant
performance boost.

We also use it for "global" variables that don't change across scripts,
such as state and country names. Great tool, I wish it were built into
PHP instead of a pecl module.

Tac

On Wed, Oct 20, 2010 at 4:50 PM, Tommy Pham wrote:

> Hi everyone,
>
> I think this question is general PHP but because I'm using Windows for

> development at the moment and was wondering if it's related to
Windows.
> Does the speed of require/require_once/include/include_once depends on

> disk activity, buffers (disks, controller, Windows)? I can't seem to
> get steady time from xdebug profile... it varies from 27ms to 170ms
> on one of my scripts while another script in the same framework with
> less require/include always have a steady ~6.5ms (the previous has 30
> requires/includes and the latter has 8 requires/includes). I only
> have the skeleton of the framework for my project (no DB access, no
> fancy html/xml output). I'm running PHP
> 5.3.3 FastCGI on Windows 2008 R2 x64 w/ 4GB RAM. SATA RAID controller

> is 3ware 9650se.
>
> Thanks for your time,
> Tommy
>
>
> --
> PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit:
> http://www.php.net/unsub.php
>
>


--
Please note my new phone number: (202) 656-7822


This message (including any attachments) may contain confidential or otherwi=
se privileged information and is intended only for the individual(s) to whic=
h it is addressed. If you are not the named addressee you should not dissemi=
nate, distribute or copy this e-mail. Please notify the sender immediately b=
y e-mail if you have received this e-mail by mistake and delete this e-mail =
from your system. E-mail transmission cannot be guaranteed to be secured or =
error-free as information could be intercepted, corrupted, lost, destroyed, =
arrive late or incomplete, or contain viruses. The sender therefore does not=
accept liability for any errors or omissions in the contents of this messag=
e or that arise as a result of e-mail transmission. If verification is requi=
red please request a hard-copy version from the sender.

www.pridedallas.com


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

RE: speed of require/include

am 21.10.2010 00:07:51 von Tommy Pham

> -----Original Message-----
> From: Keith Davis [mailto:keithdavis@pridedallas.com]
> Sent: Wednesday, October 20, 2010 2:09 PM
> To: Tac Tacelosky; Tommy Pham
> Cc: php-windows
> Subject: RE: [PHP-WIN] speed of require/include
>
> Or use Wincache. That's what we are using. Runs like a champ.
>
> Keith Davis (214) 906-5183
>
>
> -----Original Message-----
> From: Tac Tacelosky [mailto:tacman@gmail.com]
> Sent: Wednesday, October 20, 2010 4:05 PM
> To: Tommy Pham
> Cc: php-windows
> Subject: Re: [PHP-WIN] speed of require/include
>
> If you have the RAM, install php_apc -- once the scripts are included
once,
> the tokenized php will be cached in memory, can be a significant
> performance boost.
>
> We also use it for "global" variables that don't change across scripts,
such as
> state and country names. Great tool, I wish it were built into PHP
instead of
> a pecl module.
>
> Tac
>
> On Wed, Oct 20, 2010 at 4:50 PM, Tommy Pham
> wrote:
>
> > Hi everyone,
> >
> > I think this question is general PHP but because I'm using Windows for
>
> > development at the moment and was wondering if it's related to
> Windows.
> > Does the speed of require/require_once/include/include_once depends
> on
>
> > disk activity, buffers (disks, controller, Windows)? I can't seem to
> > get steady time from xdebug profile... it varies from 27ms to 170ms
> > on one of my scripts while another script in the same framework with
> > less require/include always have a steady ~6.5ms (the previous has 30
> > requires/includes and the latter has 8 requires/includes). I only
> > have the skeleton of the framework for my project (no DB access, no
> > fancy html/xml output). I'm running PHP
> > 5.3.3 FastCGI on Windows 2008 R2 x64 w/ 4GB RAM. SATA RAID controller
>
> > is 3ware 9650se.
> >
> > Thanks for your time,
> > Tommy
> >
> >
>

Hi,

Thanks for your advices. I'll look into both later but for the moment I
don't want to implement any caching yet as it will lead me to develop sloppy
code because I see fast performance.

Thanks,
Tommy


--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: speed of require/include

am 21.10.2010 00:18:13 von Michael Tacelosky

--90e6ba61365a0dc8c5049313c903
Content-Type: text/plain; charset=ISO-8859-1

"Premature optimization is the root of all evil."

http://en.wikipedia.org/wiki/Program_optimization

If you need to include a
big library to do a task, and it's cached, so what? Why are you trying to
write fast code that doesn't need caching? That's not necessarily sloppy
code. And sloppy code is often very fast. Heck, function calls are slower
than cutting and pasting duplicate code. And a class hierarchy has lots of
"inefficiencies", but saving a few CPU cycles is not a
worthwhile trade-off most of the time.

IMHO, of course.

Tac

On Wed, Oct 20, 2010 at 6:07 PM, Tommy Pham wrote:

> > -----Original Message-----
> > From: Keith Davis [mailto:keithdavis@pridedallas.com]
> > Sent: Wednesday, October 20, 2010 2:09 PM
> > To: Tac Tacelosky; Tommy Pham
> > Cc: php-windows
> > Subject: RE: [PHP-WIN] speed of require/include
> >
> > Or use Wincache. That's what we are using. Runs like a champ.
> >
> > Keith Davis (214) 906-5183
> >
> >
> > -----Original Message-----
> > From: Tac Tacelosky [mailto:tacman@gmail.com]
> > Sent: Wednesday, October 20, 2010 4:05 PM
> > To: Tommy Pham
> > Cc: php-windows
> > Subject: Re: [PHP-WIN] speed of require/include
> >
> > If you have the RAM, install php_apc -- once the scripts are included
> once,
> > the tokenized php will be cached in memory, can be a significant
> > performance boost.
> >
> > We also use it for "global" variables that don't change across scripts,
> such as
> > state and country names. Great tool, I wish it were built into PHP
> instead of
> > a pecl module.
> >
> > Tac
> >
> > On Wed, Oct 20, 2010 at 4:50 PM, Tommy Pham
> > wrote:
> >
> > > Hi everyone,
> > >
> > > I think this question is general PHP but because I'm using Windows for
> >
> > > development at the moment and was wondering if it's related to
> > Windows.
> > > Does the speed of require/require_once/include/include_once depends
> > on
> >
> > > disk activity, buffers (disks, controller, Windows)? I can't seem to
> > > get steady time from xdebug profile... it varies from 27ms to 170ms
> > > on one of my scripts while another script in the same framework with
> > > less require/include always have a steady ~6.5ms (the previous has 30
> > > requires/includes and the latter has 8 requires/includes). I only
> > > have the skeleton of the framework for my project (no DB access, no
> > > fancy html/xml output). I'm running PHP
> > > 5.3.3 FastCGI on Windows 2008 R2 x64 w/ 4GB RAM. SATA RAID controller
> >
> > > is 3ware 9650se.
> > >
> > > Thanks for your time,
> > > Tommy
> > >
> > >
> >
>
> Hi,
>
> Thanks for your advices. I'll look into both later but for the moment I
> don't want to implement any caching yet as it will lead me to develop
> sloppy
> code because I see fast performance.
>
> Thanks,
> Tommy
>
>


--
Please note my new phone number: (202) 656-7822

--90e6ba61365a0dc8c5049313c903--

Re: speed of require/include

am 21.10.2010 01:49:59 von Tommy Pham

On Wed, Oct 20, 2010 at 3:18 PM, Tac Tacelosky wrote:
> "Premature optimization is the root of all evil."
> http://en.wikipedia.org/wiki/Program_optimization
> If you need to include a big library to do a task, and it's cached, so wh=
at?
>  Why are you trying to write fast code that doesn't need caching? =
 That's
> not necessarily sloppy code.  And sloppy code is often very fast. =
 Heck,
> function calls are slower than cutting and pasting duplicate code. And a
> class hierarchy has lots of "inefficiencies", but saving a few CPU cycles=
is
> not a worthwhile trade-off most of the time.
> IMHO, of course.
> Tac
>

Hi Tac,

All that remains for this phase of the project is make the classes to
model the database accordingly and the UI (html, css, ajax, etc). So
I doubt there's much optimization I can do about those (except for
Javascript related). This project originally started with highest
script execution of about 1sec and memory usage of about 1MB, without
xdebug's profile. After completing the design to serve the purpose
needed, I trimmed it down to ~210ms (most of that is from
require/include, the actual script execution is less than 40ms).
Memory consumption is about 800KB. So for now, I'm very satisfied
except for that require/include varying times. I'll deal with it
later since the core of the project's is within reason before other
aspects (DB model, UI, etc) are built. My overall aim is to have the
application response time of 3 seconds or less (from the time the user
clicks on a link to the time when the web browser status is 'done')
before caching is applied. So far, I think I'm on track. I'd give
750ms to 1 sec for the application to get all that's needed from the
DB, and about max 750ms to process the data for output. That gives me
about 1 sec of leeway :)

Thanks,
Tommy

--
PHP Windows Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php