1 : At a glance - Are the Hack programs faster?

Each chart bar shows, for one unidentified benchmark, how much the fastest Hack program used compared to the fastest PHP program.

(Memory use is only compared for tasks that require memory to be allocated.)


These are not the only compilers and interpreters. These are not the only programs that could be written. These are not the only tasks that could be solved. These are just 10 tiny examples.

 2 : Approximately - Are the Hack programs faster?

Each table row shows, for one named benchmark, how much the fastest Hack program used compared to the fastest PHP program.

(Memory use is only compared for tasks that require memory to be allocated.)

 Hack used what fraction? used how many times more? 
Benchmark Time Memory Code
 binary-trees1/171/3±
 spectral-norm1/8 ±
 fasta1/4 ±
 mandelbrot †1/4 1/2
 regex-dna1/4±±
 n-body± ±
 k-nucleotide †±±±
 reverse-complement±±±
 fannkuch-redux † 1/2
 pidigits219× 
 Hack used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs)1/171/171/41/2±219×

† possible mismatch - one-core program compared to multi-core program.

± read the measurements and then read the program source code.

 3 : Measurements - Are the Hack programs faster?

These are not the only tasks that could be solved. These are just 10 tiny examples. These are not the only compilers and interpreters. These are not the only programs that could be written.

For each named benchmark, measurements of the fastest Hack program are shown for comparison against measurements of the fastest PHP program.

Program Source Code CPU secs Elapsed secs Memory KB Code B ≈ CPU Load
 binary-trees 
Hack34.7734.81383,096480  1% 15% 85% 1%
PHP604.84605.711,021,744472  38% 22% 42% 0%
 spectral-norm 
Hack54.8215.57117,6441195  86% 93% 87% 88%
PHP500.25126.5623,5161193  99% 99% 99% 99%
 fasta 
Hack26.0826.10117,7641109  100% 0% 0% 1%
PHP116.02116.053,3681030  0% 1% 100% 0%
 mandelbrot 
Hack80.9881.00117,520458  0% 69% 31% 0% †
PHP1,216.19305.00115,240863  100% 100% 100% 100% †
 regex-dna 
Hack6.042.61202,280832  76% 54% 38% 68%
PHP27.699.58150,456832  64% 60% 67% 100%
 n-body 
Hack550.69550.83105,9681432  55% 45% 1% 0%
PHP698.86699.073,3681082  62% 0% 38% 1%
 k-nucleotide 
Hack136.7342.43331,5041061  68% 88% 73% 96% †
PHP42.5737.50247,8561036  91% 4% 7% 13% †
 reverse-complement 
Hack6.806.82488,556261  0% 1% 97% 4%
PHP5.845.84444,344262  1% 0% 1% 100%
 fannkuch-redux 
Hack1,183.371,183.63113,336532  100% 0% 0% 1% †
PHP2,659.99667.4515,1881150  100% 100% 100% 100% †
 pidigits 
Hack488.23488.40117,868735  44% 1% 1% 57%
PHP2.222.234,064394  1% 0% 1% 100%
 fasta-redux 
No program
PHP0.640.643,3721110  2% 0% 0% 98%

† possible mismatch - one-core program compared to multi-core program.

 4 : Are there other Hack programs for these benchmarks?

Remember - those are just the fastest Hack and PHP programs measured on this OS/machine. Check if there are other implementations of these benchmark programs for Hack.

Maybe one of those other Hack programs is fastest on a different OS/machine.

 5 : Are there other faster programs for these benchmarks?

Remember - those are just the fastest Hack and PHP programs measured on this OS/machine. Check if there are faster implementations of these benchmark programs for other programming languages.

Maybe one of those other programs is fastest on a different OS/machine.

 Hack : productivity without breaking things 

HipHop VM 3.9.0 (rel)
Compiler: tags/HHVM-3.9.0-0-ga047a8f8fca8c5a0dd9021867836373ec3e40372
Repo schema: fafdc6abbd9526735214b1d74b58289707518e4f

Home Page: http://hacklang.org/

Download: http://hacklang.org/install/

Revised BSD license

  Home   Conclusions   License   Play