HipHop Virtual Machine (HHVM) is a process of virtual machine based on just-in-time(JIT) compilation, serving as an execution engine for PHP and Hack programming languages. By using the principle of JIT compilation, executed PHP or Hack code is first transformed into intermediate HipHop bytecode (HHBC), which is then dynamically translated into the x86-64 machine code, optimized and natively executed (developed by Facebook).
According to Facebook, HHVM has realized over a 9x increase in web request throughput and over a 5x reduction in memory consumption for Facebbok compared with zend PHP engine + APC (which is the current way of hosting a large majority of PHP applications).
Some Features of Hack
- « Gradual Typing (Static and Dynamic Typing)
- « Collections (Vectors, Set, Map, StableMap)
- « Generics
- « Async Functions
- « Lambda Expressions
- « Function Typing
Gradual Typing in Hack
Data Types supported in Hack include: bool, int, float, num, string
Generic Programming is a style of computer programming in which algorithm are written in terms of typesto-be-specified-later that are then instantiated when needed for specific types provided as parameters. In simple terms it allows classes and methods to be parameterized (i.e. a type associated when a class is instantiated or a method is called).
Asynchronous programming refers to a programming design pattern that allows several distinct tasks to co operatively transfer control to one another on a given thread of execution. The task are isolated from one another from the perspective of dependency minimization and task interaction. Asynchronous programming is most often used in the context of input/output (I/O). Allow mutiple functions to run cooperatively.