Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: HipHop for php

  1. #1
    Join Date
    Mar 2011
    Posts
    2,144
    Thanks
    59
    Thanked 116 Times in 113 Posts
    Blog Entries
    4

    Default HipHop for php

    From what I understand of it, HipHop for php (developed by facebook) converts php to c.
    Because php has to be interpreted each time it is run (c is already compiled) doing so should increase the speed of your site.

    Now to my question -
    Has anyone used HipHop?
    How much trouble is it to set up and use (and so forth) and are the speed increases notible?

  2. #2
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    I've read several articles about HipHop (this is a good example), and they mostly reach the same conclusion: the majority of PHP users - coders, hobbyists, small-site developers - won't see a significant improvement. The reason is that, while C++ is much much faster than PHP, the majority of your time is not spent running PHP: it's spent on external things, like database calls. (Even FB admits that HPHP only sees a 6x improvement, while good C++ executes up to 500x faster than good PHP.)

    Other major concerns:

    ...because your server becomes a single executable, you can only run one web app (site) at a time
    ...(and therefore, it's not even an option for most people who use shared hosting)

    ...HPHP isn't currently compatible with PHP >5.2
    ...(that's pretty far behind, imo... I *love* 5.4, and I won't set a client up with less than 5.3)
    ...(they're planning on supporting 5.3, and I don't know how long till that happens,
    ......but they'll always be at least one release behind no matter what)

  3. #3
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Hm. Why isn't facebook written in C# instead then? I don't really get it. PHP is great for the average web developer without a giant site. But facebook is big enough that they should do whatever works best, even if that's using C# to create a webpage... right?
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  4. #4
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    Major parts of it are written in C++ (not C#). They're kinda quiet on exactly *how much* of the site is written in PHP, but the common conclusion is that it's mostly the front-facing parts (i.e., the UI, not the DB handling/caching/data aggregation/etc.). On top of that, it's all HPHP'd and opcode-cached. Doesn't really resemble your typical PHP.

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Hm, ok. I suppose that makes sense. But you'd think that converting everything to C++, if it really is still something like 100x faster would save them thousands in server costs each year...


    On a somewhat unrelated note, I didn't actually realize that C++ and C# are different. I don't use either, though. But aren't they equivalent in casual usage? I thought it was just a short way to type it... ha. That's my new fact for the day (looking on wikipedia for a bit more info....).
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Apr 2008
    Location
    So.Cal
    Posts
    3,643
    Thanks
    63
    Thanked 516 Times in 502 Posts
    Blog Entries
    5

    Default

    I don't know how different, but enough. I've studied C, and I want eventually learn C++, but I got sidetracked by python (and then PHP 5.4 was released)

  7. #7
    Join Date
    Mar 2011
    Posts
    2,144
    Thanks
    59
    Thanked 116 Times in 113 Posts
    Blog Entries
    4

    Default

    THey didn't program fb in C because they didn't want to have to teach all their engineers C (In their opinon php is much easier for them to use/learn)

  8. #8
    Join Date
    May 2012
    Location
    Hitchhiking the Galaxy
    Posts
    1,013
    Thanks
    46
    Thanked 139 Times in 139 Posts
    Blog Entries
    1

    Default

    But then again, php is much harder to maintain on a large scale than something like say, python. They're requirments for jobs, here, for some of their jobs, include technologies such as c++, java, perl, php, python, mySQL, Oracle SQL and C to name a few, so it's obviously going to be built on a lot more than some php, I'd hedge my bets for c++ and python being used a fair bit in the site.

    Edit:
    front end is the LAMP stack.

    Edit:
    originally, the whole kit was php and the back end was a LAMP stack.
    "Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program." - Linus Torvalds
    Anime Views Forums
    Bernie

  9. #9
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    THey didn't program fb in C because they didn't want to have to teach all their engineers C (In their opinon php is much easier for them to use/learn)
    That's what I don't understand-- they have more money than they can count, right? So why not hire experts to design the best system?
    Or is it really so much easier to learn PHP that it's cheaper to use PHP in the design than to save money on servers by using C? If so, that says something in favor of PHP even if C is "better"!
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  10. #10
    Join Date
    Mar 2011
    Posts
    2,144
    Thanks
    59
    Thanked 116 Times in 113 Posts
    Blog Entries
    4

    Default

    I think a lot of the engineers they hire already have experience with php, but not c.
    But as bernie pointed out, they use a pile of different languages... (even some really obscure ones) and a lot of custom built solutions (cassandra)

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
  •