SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Evangelist Pixelateur's Avatar
    Join Date
    Feb 2006
    Location
    Hamburg, Germany
    Posts
    593
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Why is PHP so slow?

    Hey there,

    I only just got into PHP and uploaded my first site today (yay!).
    Now here's my question: To me it seems like my pages take an awful lot longer to download than previously when I used to code all my pages in HTML only (!!!). Basically, there's only one server request per page, so I really wonder what's going to happen when I have several server requests in one page. Is there any way to speed PHP up? Someone told me there's a way to "pre-bake" (???) pages, so they become as fast as ordinary HTML files...? Is this true? If yes, how can I do it?

    Greetz to all of you.

  2. #2
    SitePoint Evangelist Pixelateur's Avatar
    Join Date
    Feb 2006
    Location
    Hamburg, Germany
    Posts
    593
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oh by the way, feel free to check out my site: http://www.timokleemann.com

  3. #3
    SitePoint Enthusiast HitRaj 47's Avatar
    Join Date
    Nov 2005
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Your site loaded in 0.828 seconds for me... What connection are you on?

    The site in your sig loaded in 0.328 seconds also.

    Btw - FasterFox extension for firefox told me this.
    Beware of Raj - My Portfolio and Blog.

  4. #4
    SitePoint Wizard Pedro Monteiro's Avatar
    Join Date
    Sep 2002
    Location
    Lisbon
    Posts
    1,393
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Loaded pretty fast to me. By the way, lovely design you have there.

  5. #5
    SitePoint Evangelist Pixelateur's Avatar
    Join Date
    Feb 2006
    Location
    Hamburg, Germany
    Posts
    593
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's hosted in Germany, at an ISP called Strato.
    HitRaj, can you do me a favour and also check the times for http://www.pixellover.net/index.htm ?
    That would be cool. Else I have no reference values...

  6. #6
    SitePoint Enthusiast HitRaj 47's Avatar
    Join Date
    Nov 2005
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That site took 1.172 seconds.

    I am on 10mb though...
    Beware of Raj - My Portfolio and Blog.

  7. #7
    SitePoint Evangelist Pixelateur's Avatar
    Join Date
    Feb 2006
    Location
    Hamburg, Germany
    Posts
    593
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That IS extremely strange...! Because I have tested both sites on various machines, and PixelLover always seems much faster. Maybe I'm just biased...?!
    Thanks a lot by the way.

  8. #8
    SitePoint Mentor silver trophy
    Rubble's Avatar
    Join Date
    Dec 2005
    Location
    Cambridge, England
    Posts
    2,368
    Mentioned
    80 Post(s)
    Tagged
    3 Thread(s)
    If you have a lot of text on a page put the below at the top of your page as it can speed it up.
    PHP Code:
    ob_start("ob_gzhandler"); 
    Also this link is quite useful: http://www.websiteoptimization.com/services/analyze/

    Anthony

  9. #9
    SitePoint Zealot agoossens's Avatar
    Join Date
    Mar 2004
    Location
    Adelaide, Australia
    Posts
    124
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by PixelLover
    I only just got into PHP and uploaded my first site today (yay!). Now here's my question: To me it seems like my pages take an awful lot longer to download than previously when I used to code all my pages in HTML only (!!!).
    Of course they'll take longer to load - there's an extra step in the request pipeline now and that's PHP . If you're programming in HTML there's no PHP in the pipeline and so pages go straight from the server disk back to the user.

    If your sites are taking an exorbitant amount of time to load (whatever you do, don't get pedantic. Users will tolerate a few extra tenth's of a second) then you most likely need to re-evaluate your code.

    FWIW, both sites loaded quite quickly for me (and I'm on 128kbit ). It could be network congestion in your area.
    This space for rent.

  10. #10
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by agoossens
    If you're programming in HTML
    HTML is not a programming language.
    Birnam wood is come to Dunsinane

  11. #11
    SitePoint Evangelist Pixelateur's Avatar
    Join Date
    Feb 2006
    Location
    Hamburg, Germany
    Posts
    593
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    But both sites, www.pixellover.net and www.timokleemann.com are hosted at the exact same company. And PixelLover feels an awful lot faster wherever I log on to the site (I normally use about 5 different computers every day).

    Isn't there a way to ... let's say, "pre-compile" my PHP pages, so they load just as fast as static (HTML) pages? I'm sure this is possible, I've heard about it a couple of times. Any ideas?

  12. #12
    SitePoint Zealot agoossens's Avatar
    Join Date
    Mar 2004
    Location
    Adelaide, Australia
    Posts
    124
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by AutisticCuckoo
    Whoops, my mistake. You're right - HTML is a markup language. That was an artifact of an edit I never quite finished Ironic too, since I get get quite irked when people say what I did.

    Quote Originally Posted by PixelLover
    Isn't there a way to ... let's say, "pre-compile" my PHP pages, so they load just as fast as static (HTML) pages? I'm sure this is possible, I've heard about it a couple of times. Any ideas?
    Yes, you can - you capture the output of the script and cache it. Look into the Output Buffering functions.
    This space for rent.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •