DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
11 Monitoring and Observability Tools for 2023
Learn more
  1. DZone
  2. Data Engineering
  3. AI/ML
  4. More PHP Awesome from Facebook: The HipHop Virtual Machine

More PHP Awesome from Facebook: The HipHop Virtual Machine

John Esposito user avatar by
John Esposito
·
Dec. 09, 11 · Interview
Like (0)
Save
Tweet
Share
5.63K Views

Join the DZone community and get the full member experience.

Join For Free

Nobody can fault Facebook for performance, and they have already done several wonders with PHP performance in the past.

Their HipHop PHP to C++ translator shrank the cycles from the upper end, squeezing out the pre-C++ fat. But even the C++ to x64 translation wasn't efficient enough -- for one thing, the dynamic->static match wasn't very good.

So Facebook approached PHP performance from the lower end: they created special HipHop bytecode (HHBC), built a virtual machine for HHBC, and a dynamic HHBC->x64 translator. 

Today Facebook posted a full explanation of the HipHop virtual machine, recalling the sweetness of those CS courses that kept you awake in school but faded into forgetfulness as you began to face tough development deadlines (or just switched over to mostly high-level languages)...

It does work faster (1.6 times). Here's the heart of the tech, in Facebook's words:

Throughout the hhvm project we have tended toward simple solutions. This is nowhere more evident than in the core premise of the dynamic translator itself. Most existing systems use method-at-a-time JIT compilation (e.g., Java and C#), though trace-based translation has also been explored in recent systems (e.g., Tamarin and TraceMonkey). We decided to try a very simple form of tracing that limits each trace to a single basic block with known input types. This "tracelet" approach simplifies the trace cache management problem, because complex application control flow cannot create a combinatorial explosion of traces.


This makes more sense with diagrams and examples, so check out the full blogpost, the bytecode spec, or the full HipHop project. And fall in love with PHP wizardry all over again.

 

PHP Virtual Machine facebook Machine Awesome (window manager)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Container Security: Don't Let Your Guard Down
  • GitLab vs Jenkins: Which Is the Best CI/CD Tool?
  • Cloud Performance Engineering
  • Top 10 Best Practices for Web Application Testing

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: