Author Topic: Facebook creates its own PHP  (Read 1898 times)

Offline codestryke

  • Administrator
  • Level 33
  • *****
  • Posts: 588
  • Reputation: +22/-0
    • View Profile
    • eXtremeCast Games
Facebook creates its own PHP
« on: February 02, 2010, 12:54:32 PM »
Surprised no one has mentioned this yet

http://www.readwriteweb.com/archives/facebook_gets_faster_debuts_homegrown_php_compiler.php

Finally someone is doing something to push PHP :)

Creating online addictions, one game at a time:

Offline aquilax

  • Level 5
  • *
  • Posts: 20
  • Reputation: +1/-0
    • View Profile
    • Internet games
Re: Facebook creates its own PHP
« Reply #1 on: February 02, 2010, 01:14:44 PM »
Here is the press release: http://www.facebook.com/note.php?note_id=280583813919&id=9445547199&ref=nf

In fact they just compile parts of the code to C++ which is kind of useful for browser games.

Offline JGadrow

  • Level 35
  • **
  • Posts: 1,133
  • Reputation: +23/-2
    • View Profile
Re: Facebook creates its own PHP
« Reply #2 on: February 02, 2010, 01:21:59 PM »
I've been thinking more and more that I just need to begin writing some sort of "base application" in C++ that would eliminate my need to work in PHP for web projects at all. There would be many advantages to it. It seems others are thinking the same thing that I am. PHP is trying so hard to be C's little brother. ;)
Idiocy - Never underestimate the power of stupid people in large groups.


Offline aquilax

  • Level 5
  • *
  • Posts: 20
  • Reputation: +1/-0
    • View Profile
    • Internet games
Re: Facebook creates its own PHP
« Reply #3 on: February 02, 2010, 01:27:45 PM »
In terms of speed yes C/C++ are the kings but the whole write->compile->link->deploy cycle is vicious.

Offline JGadrow

  • Level 35
  • **
  • Posts: 1,133
  • Reputation: +23/-2
    • View Profile
Re: Facebook creates its own PHP
« Reply #4 on: February 02, 2010, 01:35:44 PM »
*shrug* I like it. lol But, usually you put the compile and link steps together and the cycle is:

write->build->deploy

Which just looks nicer though it doesn't really help much. lol :P

I really can't wait for D to become a more mature language. The one thing I dislike about C++ is that you have to do certain things solely for C compatability. D is aiming to be C++ improved.

Anyone interested might want to check out D.
Idiocy - Never underestimate the power of stupid people in large groups.


Offline codestryke

  • Administrator
  • Level 33
  • *****
  • Posts: 588
  • Reputation: +22/-0
    • View Profile
    • eXtremeCast Games
Re: Facebook creates its own PHP
« Reply #5 on: February 02, 2010, 02:00:10 PM »
For the past couple months I've really been wondering if PHP should remain my main area of focus when it comes to PBBG development. More and more things are moving to a background process with the browser communicating to said background process. With this type of architecture PHP has no future as it is now. It was written and continues to be a development environment made for creating dynamic pages (parse, compile, output).

With all the talk of HTML5 canvas, CSS3 and persistent connections with ajax the technology of PHP is starting to fall very short very quickly IMHO. As JGardow pointed out in a recent post "a game is an application" ;)



Creating online addictions, one game at a time:

Offline Marek

  • Level 17
  • *
  • Posts: 170
  • Reputation: +6/-0
  • XHTML, CSS, JS, PHP and MySQL are my pantheon.
    • View Profile
Re: Facebook creates its own PHP
« Reply #6 on: February 02, 2010, 02:10:07 PM »
Compiled languages have the advantage of performance, but honestly, that's essentially the only thing they excel at (except for the requirements of very low-level programming).

It's 2010. Other than in exceptional circumstances (Facebook being an exceptionally huge site) what is the relevance of compiled languages?

Bytecode compiled languages like C# are mature and powerful (and no, just because it's made by "Micro$oft" does not make it any less powerful). A Python application can be orders of magnitude shorter and simpler than an equivalent C++ program. I don't understand the masochistic tendency for some people to cling to compiled languages in situations where they are not necessary.

I don't think I've seen a site running compiled CGI since, I don't know, 1999. Look at how quickly Ruby and RoR became popular. That's the direction the web is going. It's called going forwards, not backwards.

Offline JGadrow

  • Level 35
  • **
  • Posts: 1,133
  • Reputation: +23/-2
    • View Profile
Re: Facebook creates its own PHP
« Reply #7 on: February 02, 2010, 02:25:41 PM »
Bytecode compiled languages like C# are mature and powerful (and no, just because it's made by "Micro$oft" does not make it any less powerful).
No, it just puts you in league with evil. I try not to subject myself to further corruption where possible. ;)

In regards to your other statements about the place of complied programs in software... somewhere, something has been compiled.

Compiled languages are here to stay. No matter what, there will be a need for at least one program to communicate with the machine. Non-compiled languages are not really "programming languages" in the strictest sense. They're scripting languages. But that's an argument I'm not going to win and don't really care to. lol I count it a win if I can convince a company that "HTML + CSS does not make you a developer it makes you a designer." lol

So, technically, all web applications are using a compiled program. You've just been abstracted away from that portion of the application. Don't get me wrong, it's nice, but sometimes you just get fed up with being controlled by the underlying foundational application that you say: "To hell with this! I'll write my own!" So, I'm not a masochist, I'm a control-freak. lol ;)

*edit - forgot to close the quote block and omitted the word 'try'. D'oh!
Idiocy - Never underestimate the power of stupid people in large groups.


Offline Nox

  • Level 35
  • **
  • Posts: 738
  • Reputation: +12/-2
    • View Profile
Re: Facebook creates its own PHP
« Reply #8 on: February 02, 2010, 02:30:27 PM »
(noob alert)
They're changing just the core or also syntax? They'd have to rewrite tons of files so I guess not...?

Out of other languages I'm most attracted by Python but I fear the result would be much worse actually as I don't know it much...

BTW don't you know any free Python hostings if one wants to just try writing in it?
« Last Edit: February 02, 2010, 02:45:16 PM by Nox »
Meet us at an IRC irc.freenode.net #bbg as well
Enjoy http://spiritbeacon.noxart.cz/ !

Offline aquilax

  • Level 5
  • *
  • Posts: 20
  • Reputation: +1/-0
    • View Profile
    • Internet games
Re: Facebook creates its own PHP
« Reply #9 on: February 02, 2010, 02:56:55 PM »
BTW don't you know any free Python hostings if one wants to just try writing in it?

Google App Engine is nice and free if you can live with Big Table.

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,133
  • Reputation: +26/-1
    • View Profile
Re: Facebook creates its own PHP
« Reply #10 on: February 02, 2010, 04:49:36 PM »
For the past couple months I've really been wondering if PHP should remain my main area of focus when it comes to PBBG development. More and more things are moving to a background process with the browser communicating to said background process. With this type of architecture PHP has no future as it is now. It was written and continues to be a development environment made for creating dynamic pages (parse, compile, output).

With all the talk of HTML5 canvas, CSS3 and persistent connections with ajax the technology of PHP is starting to fall very short very quickly IMHO. As JGardow pointed out in a recent post "a game is an application" ;)
I think you do not fully realize the scary implications of such improvements of browser capabilities. It will end the way current PC gaming market is. In not so distant past serious hobbists were able to make a fully fledged PC game within reasonable budget. Now, you can not. You need millions of $$$ no matter what, just for gfx content alone. Nowadays no one on this forum can release PC title no matter what.
If you truly want to follow all up to date technologies the obvious choice is Flash :D But it will not end here there will be Web3D and thousands of others evil things :)

I don't know about you guys, but I won't follow this route. I was in 3D games PC dev market and don't want to go back ever again. I will continue making my crappy looking outdated technology but awesome playability games :)

Offline Nox

  • Level 35
  • **
  • Posts: 738
  • Reputation: +12/-2
    • View Profile
Re: Facebook creates its own PHP
« Reply #11 on: February 03, 2010, 09:51:48 AM »
Meet us at an IRC irc.freenode.net #bbg as well
Enjoy http://spiritbeacon.noxart.cz/ !

Offline Harkins

  • Level 28
  • **
  • Posts: 420
  • Reputation: +11/-2
  • Coder, blogger, entrepreneur.
    • View Profile
    • Push CX - Blog
Re: Facebook creates its own PHP
« Reply #12 on: February 03, 2010, 11:33:56 AM »
I think you do not fully realize the scary implications of such improvements of browser capabilities. It will end the way current PC gaming market is. In not so distant past serious hobbists were able to make a fully fledged PC game within reasonable budget. Now, you can not. You need millions of $$$ no matter what, just for gfx content alone. Nowadays no one on this forum can release PC title no matter what.

I think this is entirely possible and I've seen escalating budgets, team sizes, and build times in the online gaming I've watched, and established PC teams (like Twisted Mill with Nile Online) moving into the space.

My bet is that there's still room for small, independent games, at least for the next five years or so. And even on the PC side, it's possible to find an unserved gameplay niche and make a living there. My hero there is Dwarf Fortress, a player supported game created by a pair of brothers.

Quote from: codestryke
For the past couple months I've really been wondering if PHP should remain my main area of focus when it comes to PBBG development. More and more things are moving to a background process with the browser communicating to said background process.

Yeah, I'm using a neat queue system called resque from the GitHub folks for exactly this reason. My game is a system and data; the web is just one frontend. Facebook will be another. I can vaguely imagine others like browser toolbars and iPhone apps. But I have to build well from the start to get there.

Visit #bbg on irc.freenode.net to talk browser games anytime.

Offline codestryke

  • Administrator
  • Level 33
  • *****
  • Posts: 588
  • Reputation: +22/-0
    • View Profile
    • eXtremeCast Games
Re: Facebook creates its own PHP
« Reply #13 on: February 03, 2010, 12:45:43 PM »
From the article below it's not just PHP, well it is, but the dumped the need for Apache!
http://www.developer.com/lang/php/article.php/3862461/Facebooks-HipHop-Goes-Public-With-a-New-PHP-Runtime.htm

Creating online addictions, one game at a time:

Offline Delifisek

  • Level 12
  • *
  • Posts: 79
  • Reputation: +1/-1
    • View Profile
Re: Facebook creates its own PHP
« Reply #14 on: February 03, 2010, 06:18:47 PM »
It was not something for us.

If you had performance problem, you may look for db.

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,133
  • Reputation: +26/-1
    • View Profile
Re: Facebook creates its own PHP
« Reply #15 on: February 04, 2010, 04:42:45 AM »
Quote
Facebook said the results of using HipHop have been dramatic. CPU usage on Facebook servers has dropped by an average of 50 percent as the HipHop PHP engine reduced the load on Facebook's infrastructure.
This one made me puzzled, from browser games experience I think even if PHP execution cost was 0, it still would not improve overall performance by 50% since SQL uses more than 50% with current not so optimized PHP... Is Facebook nature/implementation so different form browser games?

Offline bbgames

  • Level 16
  • *
  • Posts: 138
  • Reputation: +1/-0
    • View Profile
    • Building Browsergames
Re: Facebook creates its own PHP
« Reply #16 on: February 04, 2010, 09:12:47 AM »
This one made me puzzled, from browser games experience I think even if PHP execution cost was 0, it still would not improve overall performance by 50%...

I think that's because you may be looking at this the wrong way. I can't speak to whether HipHop actually makes PHP faster at all - but by shaving off CPU time, they're able to squeeze out more requests per second, per server. So while the site may seem more performant (or at least, similarly performant on less infrastructure), I think it may only be because they're about to deal with that many more requests per second (rather than having shaved 6 seconds off their execution time, for example).

I could be wrong - but this seems like the best explanation to me thus far.

Offline 133794m3r

  • Level 22
  • *
  • Posts: 265
  • Reputation: +2/-0
    • View Profile
Re: Facebook creates its own PHP
« Reply #17 on: February 05, 2010, 08:57:35 AM »
hmm just reading over this makes it sound pretty interesting. Although as the person who wrote it has said, it's mostly for the facebook person in mind, it is still something interesting to hear about. It's nice to know that PHP is finally getting a RoR type framework. I was always wondering how the bigger companies handled php itself since i always heard that RoR was the best deployment system.

I can't wait till the code's up on github for everyone to see. As they said they did this 3 days ago, and it's not there for me to see yet... but having an amazing JIT compiler version of Hiphop sounds amazing. The downside is that servers have to be restarted to do any code changes but then again maintenance can just be declared when you're going to change anything. As i was always planning on doing code changes during a maintenance anyway to just be on the safe side.

Can't wait to see how this thing evolves, knowing that i just got into php and been messing around with it since last december it seems that this is the year for it. Atleast it seems to be for me :P with hiphop coming out... IF any of the games gets big it'll be a nice thing to have.

Offline Harkins

  • Level 28
  • **
  • Posts: 420
  • Reputation: +11/-2
  • Coder, blogger, entrepreneur.
    • View Profile
    • Push CX - Blog
Re: Facebook creates its own PHP
« Reply #18 on: February 05, 2010, 10:49:38 AM »
It's nice to know that PHP is finally getting a RoR type framework.

It's not. HipHop is a compiler, not a framework. There are a few RoR-like PHP frameworks, I've heard of CakePHP and Kohana.

Quote
I was always wondering how the bigger companies handled php itself since i always heard that RoR was the best deployment system.

Rails doesn't really have anything to say about deployment, just web code. The community happened to create tools like Capistrano, Chef, Puppet, etc., and they can all be used for PHP sites fine.

Visit #bbg on irc.freenode.net to talk browser games anytime.

Offline 133794m3r

  • Level 22
  • *
  • Posts: 265
  • Reputation: +2/-0
    • View Profile
Re: Facebook creates its own PHP
« Reply #19 on: February 05, 2010, 10:29:56 PM »
It's nice to know that PHP is finally getting a RoR type framework.

It's not. HipHop is a compiler, not a framework. There are a few RoR-like PHP frameworks, I've heard of CakePHP and Kohana.

Quote
I was always wondering how the bigger companies handled php itself since i always heard that RoR was the best deployment system.

Rails doesn't really have anything to say about deployment, just web code. The community happened to create tools like Capistrano, Chef, Puppet, etc., and they can all be used for PHP sites fine.

:/ RoR still makes large scale deployments alot easier to work with. And considering that hiphop in it's compiling of code does the same thing i consider it to be somthing very similar. and RoR allows for your deployment to scale much easier than it would if it was on php. Or so says Twitter, and the RoR site.

Offline Chris

  • Game Owner
  • Level 35
  • *
  • Posts: 2,133
  • Reputation: +26/-1
    • View Profile
Re: Facebook creates its own PHP
« Reply #20 on: February 06, 2010, 05:19:21 AM »
Explanation how it works to people who are confused (correct me if I messed up something since it is based on reading articles/news only).

Pure PHP
- PHP executable (not .php file) was written in C/C++ then converted to machine code which is the only "language" that can be read by CPU.
- when .php file is accessed the PHP read the .php file and create token (token is very similar to .php file but it is more degistable to machines like function names are converted into numbers, removed comments, etc) .
- token is interpreted (it means it tells PHP what to do) and then according to the instruction PHP executable do things

eAccelerator + Zend Optimizer
- if you have these .php file is read only once (and reread each time the file changes) and immediately token is created. The token is persistent. Also the optimizer make some changes to the token to make if faster to execute.

HipHop
- at first it looks as similar to eAccelerator since it reads .php only once, but the difference is it creates no token but true machine code executable.
- once executable is created PHP do not interpret anything, it works the other way round. Now the "binary representation of .php file" calls PHP to execute things. It is not interpreted language anymore, nothing is parsed, nothing is interpreted, now there are 2 machine code executables (which are absolute fastest beings/"languages" that could possibly exist) that work together.

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal