PHP to C++ compiler from Facebook - HipHop

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

User avatar
arjan.top
Forum Contributor
Posts: 305
Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia

Re: New PHP from Facebook?

Post by arjan.top »

PCSpectra wrote: 'close' or 'almost' are so vague when comparing benchmark performance. It's widely accepted that a native C application will out perform a Java equivelant anytime. I think high use, daemon systems will remain developed in C for a long while.
I do not think that java is great for everything, I do not see it as a "system" language
Java and C both have advantages, but in different areas

Maybe, but all that that proves, is it's possible to build faster software using more abstraction, if the original software is poorly implemented.
you get access to all the java libraries too
I'm not a fan of Java, so I admit I'm being biased, but everything Java built seems really sluggish, buggy and slow to respond. Just look at Eclipse compared to a native Windows editor. :P
you should give eclipse more memory
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Re: New PHP from Facebook?

Post by Jenk »

arjan.top wrote:you should give eclipse more memory
Typical Java-fan reply :/ Why should I? If I have something equivalent, which doesn't need more memory, why should the Java-based app demand more?

Java is not as great as many think. In fact it is a benchmark for poor pattern implementation and don't even get me started on it's consistent flaw, and bodges, because of strict types. Programming in Java is like programming in a straight jacket, and is sluggish to boot. In a bid to make Java as flexible as possible, they have implemented far too much behaviour into too many of their core domain, meaning there is a *LOT* of bloat.
User avatar
arjan.top
Forum Contributor
Posts: 305
Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia

Re: New PHP from Facebook?

Post by arjan.top »

php uses about the same amount of memory as java, so it sucks too?

I do not think java is great, some APIs are really "dumb" (same with PHP), you can still use groovy, scala, clojure (...) on the JVM

But java is not near slow, it was in the past but 1.6 is really fast, it would just get faster
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Re: New PHP from Facebook?

Post by Jenk »

We expect PHP to be slow, it is an interpreted language. Java is not, and even has C compilation behind it.. so it really has no excuse.
User avatar
arjan.top
Forum Contributor
Posts: 305
Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia

Re: New PHP from Facebook?

Post by arjan.top »

the question was about memory

every JIT language would need more memory than the compiled version
so it really has no excuse.
no excuse for what?
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Re: New PHP from Facebook?

Post by Jenk »

Memory consumption is the primary cause for apps to be slow. PHP is interpreted, which uses more memory as it compiles/translates, which makes it slower. Java does not do this.
User avatar
arjan.top
Forum Contributor
Posts: 305
Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia

Re: New PHP from Facebook?

Post by arjan.top »

java is interpreted, "hot code" is compiled

edit: i don't think 200MB for something as complex as eclipse (wrih some plugins) is a lot
User avatar
arjan.top
Forum Contributor
Posts: 305
Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia

Re: New PHP from Facebook?

Post by arjan.top »

User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: New PHP from Facebook?

Post by Benjamin »

Stay on topic folks.
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Re: New PHP from Facebook?

Post by Jenk »

Ok, back on topic.. I'm slightly annoyed they've done this behind closed doors. It smells like something MS would do in a dirty takeover. I also wonder how "open" it will be, and if it's tailored for Facebook, or is in fact a generic improvement.
User avatar
arjan.top
Forum Contributor
Posts: 305
Joined: Sun Oct 14, 2007 4:36 am
Location: Hoče, Slovenia

Re: New PHP from Facebook?

Post by arjan.top »

User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: New PHP from Facebook?

Post by Christopher »

Jenk wrote:... I'm slightly annoyed they've done this behind closed doors. It smells like something MS would do in a dirty takeover. I also wonder how "open" it will be, and if it's tailored for Facebook, or is in fact a generic improvement.
Well ... they spent their own money to develop it and will release it under the PHP license tonight. That doesn't sound like a "dirty takeover" to me. I think Facebook has long been a supporter of PHP.

It is called HipHop for PHP. What they are doing is converting PHP into C++ and then compiling it. It sounds like currently you loose some things, like eval(), and they have only converted some extensions. And it may not behave exactly like PHP for variable typing, etc. But you do get code that runs about twice as fast -- according to the article. it sounds like they have

Since it is release under the same license as PHP, then the community and PHP Group may choose to get involved in filling out the features. Maybe with more people thinking about solutions. For example, perhaps APC could compile to C++ as well as opcode?

There is a live streamed tech talk about at 7:30PST for those interested (at the link above).
(#10850)
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: New PHP from Facebook?

Post by alex.barylski »

you should give eclipse more memory
LOL

It's why I went out and bought a brand new cutting edge computer system i7 quad core with 12GB of DDR3?? Memory...If Eclipse is running like ahog on this machine I give up on Eclipse ever being a performant IDE. :P
It is called HipHop for PHP. What they are doing is converting PHP into C++ and then compiling it. It sounds like currently you loose some things, like eval(), and they have only converted some extensions. And it may not behave exactly like PHP for variable typing, etc. But you do get code that runs about twice as fast -- according to the article. it sounds like they have
Thats what I was afraid of...there are attempts at this already (phc, roadsend, etc). How does it handle with the most flexible technqiue employedd by professional PHP developers, such as class autoloading? Constructing class names on the fly then instantiating that class to support plug 'n play?

I would be wary about using such a thing...not as exciting as I had hoped. Ah well...PHP still rocks. 8)

Cheers,
Alex
User avatar
Jenk
DevNet Master
Posts: 3587
Joined: Mon Sep 19, 2005 6:24 am
Location: London

Re: New PHP from Facebook?

Post by Jenk »

arborint wrote:
Jenk wrote:... I'm slightly annoyed they've done this behind closed doors. It smells like something MS would do in a dirty takeover. I also wonder how "open" it will be, and if it's tailored for Facebook, or is in fact a generic improvement.
Well ... they spent their own money to develop it and will release it under the PHP license tonight. That doesn't sound like a "dirty takeover" to me. I think Facebook has long been a supporter of PHP.

It is called HipHop for PHP. What they are doing is converting PHP into C++ and then compiling it. It sounds like currently you loose some things, like eval(), and they have only converted some extensions. And it may not behave exactly like PHP for variable typing, etc. But you do get code that runs about twice as fast -- according to the article. it sounds like they have

Since it is release under the same license as PHP, then the community and PHP Group may choose to get involved in filling out the features. Maybe with more people thinking about solutions. For example, perhaps APC could compile to C++ as well as opcode?

There is a live streamed tech talk about at 7:30PST for those interested (at the link above).
Why didn't they do it in the open? They've basically said "This is how we think PHP should be, so here it is." and are now plugging their speed increase in a "HEY GUYS, COME USE OUR PHP INSTEAD!" kind of way, by the looks of it.

What they should have done was make their intentions known, and then allow some form of input from the community. Not take from a community driven project, hide away, and then unleash a largely unknown and unfamiliar, yet "better" version onto the same community. At least for the beginning it will make anyone who uses this compiler dependent upon the FB devs for support/guidance/etc. Until someone finds a glaring hole, most probably.

That is the "dirty takeover". The spotlight has shifted from the PHP team to Facebook, who will no doubt be wearing the "I'm the PHP Daddy" T-shirt.
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: PHP to C++ compiler from Facebook - HipHop

Post by Eran »

Why didn't they do it in the open?
It was internal development for their private use. Do you always develop your internal stuff in the open? now they decided to make it open. why all the negativity?
Post Reply