Re: PHP Performance - 1’000’000 iterat ions
| From: | Kris Craig | Date: | Mon, 20 Aug 2012 01:06:08 +0000 |
| Subject: | Re: PHP Performance - 1’000’000 iterat ions | ||
| References: | 1 2 3 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-62274@lists.php.net to get a copy of this message | ||
It's also worth noting that a billion iterations is a lot in any language,
not just PHP. Plus most browsers would probably blow-up in your face if
you tried to send that much data.
--Kris
On Sun, Aug 19, 2012 at 8:41 AM, Raymond Irving <xwisdom@gmail.com> wrote:
> Many thanks for the feedback.
>
> __
> Raymond
>
> On Sun, Aug 19, 2012 at 10:02 AM, Rasmus Lerdorf <rasmus@lerdorf.com>
> wrote:
>
> > On 08/19/2012 10:29 AM, Raymond Irving wrote:
> > > Hello,
> > >
> > > What could have cause PHP to start out so great but then slows to a
> > crawl?
> > > Could it be the GC?
> > >
> > > Number of iterations Node.js PHP
> > > ---------------------------------------------------------------
> > > 100 2.00 0.14
> > > 10’000 3.00 10.53
> > > 1’000’000 15.00 1119.24
> > > 10’000’000 143.00 10621.46
> > > 1’000’000’000 11118.00 1036272.19
> > >
> > > See the script here:
> > >
> >
>
> http://net.tutsplus.com/tutorials/javascript-ajax/node-js-for-beginners/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+nettuts+%28Nettuts%2B%29
> > >
> > > Is there any way that this can be improved?
> >
> > If you are doing something that needs to iterate a billion times, you
> > shouldn't be using PHP. Things like calculating a fractal is just not
> > what PHP was meant for. The vast majority of Web apps have absolutely no
> > need to iterate that many times. You wouldn't try to show a user a
> > billion database records on a single page, for example. Chances are
> > pretty good that you are going to iterate less than 1000 times on a
> > typical request and if you do end up having to iterate more for some
> > reason, you would probably cache the result somewhere so you don't have
> > to do it on a subsequent request.
> >
> > -Rasmus
> >
>