Facebook invents a PHP virtual machine to interprete PHP 9x faster

shakirmoledina

Legend
OP
Member
Joined
Oct 23, 2004
Messages
6,613
Trophies
0
Age
31
Location
Dar es Salaam
Website
vfootball.co.nf
XP
790
Country
Tanzania
I'm no expert in these matters but Facebook's take on speed and their ability to adept to the growth of its network has always fascinated me.

Among the many strategies that Facebook has 'innovated', Facebook has come up with a new virtual machine that would convert the human readable source code into machine-readable byte code when it is needed.

That is because their current Virtual Machine iteration has a JIT (Just in Time).
How useful is JIT? Check out the latest version of DeSmuME or nds4droid and PPSSPP on the Android and PC (latter).

This JIT approach allows the virtual machine to "make smarter decisions at runtime," Pobar said. For instance, if a call is made to the MySQL database to read a row of data, the HHVM can, on the fly, figure out what type of data it is, such as an integer or a string. It then can generate or call code on the fly that would be best suited for handling this particular type of data.

Technical Bit:
PHP programs are slowly due to PHP being an interpreted language while compiled languages such as C or C++ are faster as they are compiled beforehand into machine language byte code.

The previous iteration (HipHop) used to translate PHP into C++ and produced a considerable speed gain. However with Facebook's ever growing nature, HHVM has been developed that works similar to the Java Virtual Machine (JVM). Java has been considered to be a Hybrid language that converts the human readable source code into machine-readable byte code when it is needed.

Facebook has posted the code for HHVM on GitHub, with the hopes that others will use it to speed their PHP websites as well.

PHP driven websites such as Twitter, Wikipedia and Wordpress may potentially benefit from this technology to around 5x its current performance.

SOURCE
GitHub
 
  • Like
Reactions: Coto

Rydian

Resident Furvert™
Member
Joined
Feb 4, 2010
Messages
27,880
Trophies
0
Age
34
Location
Cave Entrance, Watching Cyan Write Letters
Website
rydian.net
XP
8,898
Country
United States
Java uses JIT: "JAVA SUCKS BECAUSE IT'S NOT COMPILED IT'S NOT A REAL PROGRAMMING LANGUAGE"
7 years later, everybody else uses JIT: "HOLY SHIT THIS IS THE BEST TECHNOLOGY EVERRRRRR!!!"

Also I find it ironic that PHP/Perl/Python (and other interpreted languages) are compiled to binaries and run on the fly, but the phrase "JIT" (Just In Time (Compilation)) doesn't apply to that idea. :P
 

shakirmoledina

Legend
OP
Member
Joined
Oct 23, 2004
Messages
6,613
Trophies
0
Age
31
Location
Dar es Salaam
Website
vfootball.co.nf
XP
790
Country
Tanzania
Java uses JIT: "JAVA SUCKS BECAUSE IT'S NOT COMPILED IT'S NOT A REAL PROGRAMMING LANGUAGE"
7 years later, everybody else uses JIT: "HOLY SHIT THIS IS THE BEST TECHNOLOGY EVERRRRRR!!!"

Also I find it ironic that PHP/Perl/Python (and other interpreted languages) are compiled to binaries and run on the fly, but the phrase "JIT" (Just In Time (Compilation)) doesn't apply to that idea. :P

I never see JIT as 'just in time'. Eh, just a way of making it seem a little fancy i guess.

Is this 9x faster than their previous weird compiled php thing they were doing a year or so back ( http://www.theregister.co.uk/2011/12/14/faceboook_juices_php_juice/ ) or just 9x faster than stock PHP?

Pobar estimated that HHVM is about twice as fast as HPHPc was, and about nine times as fast as running straight PHP.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
    SG854 @ SG854: I did it. I became a God.