HipHop Virtual Machine
Ratheesh kumar R
From this session ..
★ WHO ?
★ FOR WHAT ?
★ STORY BEHIND THE INVENTION
★ CHANCES
★ RISKS
★ REFERENCE
2
facebook
★ Second largest website in the world.
★ 1.35 billion active users per month.
★ 9000 logins in every seconds.
★ 185 petabytes of data transfer per year.
★ 10-30 million lines of PHP code.
3
Performance Issues for Facebook
★ Facebook invented there on TCP/IP stack.
★ PHP is an interpreted language.
★ PHP waits for I/O devices,Database,HTTP Response.
4
Resource issues for Facebook
★ Runs on lakhs of servers.
★ Operational Cost.
★ Maintenance.
★ Space.
★ Employes
5
First Step in 2008
HipHop Compiler
Transform php into C++
6
Advantages of HipHop Compiler
★ Having all advantages of a compiled language.
★ Compilation need to be done once.
★ Only need to execute converted binary file.
★ Much faster than normal php execution.
★ Low resource usage.
★ Facebook saved around 10 to 20% of resource usage.
7
Issues with HipHop Compiler
★ Lost all the advantages of Interpreted Language.
★ Whole code need to compiled every time after a change.
★ 3 to 5 GB of binary code for facebook.
★ Hard to deploy in server.
★ Unhappy developers.
★ Hard to debug.
8
Second Step in 2010
HipHop Virtual Machine or
HHVM
Just-in-time compiler
9
What is HHVM ?
★ HipHop Virtual Machine
★ Created by engineers at Facebook
★ New PHP runtime.
★ Translates PHP to Bytecode(HHBC - Hip Hop ByteCode)
★ Just-in-time compiler, turning generated bytecode into machine code.
★ In some cases 5 to 10 times faster than regular PHP
★ No need of Zend Engine
10
Just-In-Time Compiler
11
Issues arose then ...
★ PHP is a loosely typed language.
★ Assembly language is strictly typed.
★ Hard to convert PHP to Assembly language.
★ Time taken for Type conversions.
★ Hard to implement a new language other than PHP.
12
Third Step in 2010
Programming Language for HHVM
13
Hack Programming Language
➔ Programming language for HHVM.
➔ Evolved from PHP.
➔ If you know PHP,you know Hack.
➔ Hack provides a more predictable PHP.
➔ Statically typed language.
14
PHP v/s HACK
15
Issues Solved & Chances of HHVM
★ Better performance.
★ Low resource usage.
★ Hack as the new PHP.
★ Write PHP extensions in PHP.
★ Good for hosting companies.
16
Risks in HHVM
★ No real open source project.
★ Facebook could loose interest.
★ A community split between PHP and Hack
★ Your favourite extension may not be available.
★ Limited IDE support.
★ Will not support 32-bit operating systems.
17
Happy people using HHVM
18
References
http://hacklang.org/
http://hhvm.com/
http://docs.hhvm.com/manual/en/index.php
https://github.com/facebook/hhvm
Google Keywords
Use “HipHop compiler” or “HHVM”
19
Questions ?
20

Hiphop - PHP

  • 1.
  • 2.
    From this session.. ★ WHO ? ★ FOR WHAT ? ★ STORY BEHIND THE INVENTION ★ CHANCES ★ RISKS ★ REFERENCE 2
  • 3.
    facebook ★ Second largestwebsite in the world. ★ 1.35 billion active users per month. ★ 9000 logins in every seconds. ★ 185 petabytes of data transfer per year. ★ 10-30 million lines of PHP code. 3
  • 4.
    Performance Issues forFacebook ★ Facebook invented there on TCP/IP stack. ★ PHP is an interpreted language. ★ PHP waits for I/O devices,Database,HTTP Response. 4
  • 5.
    Resource issues forFacebook ★ Runs on lakhs of servers. ★ Operational Cost. ★ Maintenance. ★ Space. ★ Employes 5
  • 6.
    First Step in2008 HipHop Compiler Transform php into C++ 6
  • 7.
    Advantages of HipHopCompiler ★ Having all advantages of a compiled language. ★ Compilation need to be done once. ★ Only need to execute converted binary file. ★ Much faster than normal php execution. ★ Low resource usage. ★ Facebook saved around 10 to 20% of resource usage. 7
  • 8.
    Issues with HipHopCompiler ★ Lost all the advantages of Interpreted Language. ★ Whole code need to compiled every time after a change. ★ 3 to 5 GB of binary code for facebook. ★ Hard to deploy in server. ★ Unhappy developers. ★ Hard to debug. 8
  • 9.
    Second Step in2010 HipHop Virtual Machine or HHVM Just-in-time compiler 9
  • 10.
    What is HHVM? ★ HipHop Virtual Machine ★ Created by engineers at Facebook ★ New PHP runtime. ★ Translates PHP to Bytecode(HHBC - Hip Hop ByteCode) ★ Just-in-time compiler, turning generated bytecode into machine code. ★ In some cases 5 to 10 times faster than regular PHP ★ No need of Zend Engine 10
  • 11.
  • 12.
    Issues arose then... ★ PHP is a loosely typed language. ★ Assembly language is strictly typed. ★ Hard to convert PHP to Assembly language. ★ Time taken for Type conversions. ★ Hard to implement a new language other than PHP. 12
  • 13.
    Third Step in2010 Programming Language for HHVM 13
  • 14.
    Hack Programming Language ➔Programming language for HHVM. ➔ Evolved from PHP. ➔ If you know PHP,you know Hack. ➔ Hack provides a more predictable PHP. ➔ Statically typed language. 14
  • 15.
  • 16.
    Issues Solved &Chances of HHVM ★ Better performance. ★ Low resource usage. ★ Hack as the new PHP. ★ Write PHP extensions in PHP. ★ Good for hosting companies. 16
  • 17.
    Risks in HHVM ★No real open source project. ★ Facebook could loose interest. ★ A community split between PHP and Hack ★ Your favourite extension may not be available. ★ Limited IDE support. ★ Will not support 32-bit operating systems. 17
  • 18.
  • 19.
  • 20.