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/161/2±
 spectral-norm1/9 ±
 fasta1/5 ±
 mandelbrot †1/4 1/2
 regex-dna1/4±±
 n-body± ±
 k-nucleotide †±±±
 reverse-complement±±±
 fannkuch-redux † 1/2
 pidigits218× 
 Hack used what fraction? used how many times more? 
Time-used  |-  |---  25% median  75%  ---|  -|
(Elapsed secs)1/161/161/51/2±218×

† 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 
Hack37.6037.63640,168480  100% 1% 1% 0%
PHP604.84605.711,021,744472  38% 22% 42% 0%
 spectral-norm 
Hack54.3714.19108,5441195  97% 96% 95% 97%
PHP500.25126.5623,5161193  99% 99% 99% 99%
 fasta 
Hack25.0725.08119,6321109  1% 1% 99% 1%
PHP116.02116.053,3681030  0% 1% 100% 0%
 mandelbrot 
Hack80.8480.86119,900458  100% 1% 0% 1% †
PHP1,216.19305.00115,240863  100% 100% 100% 100% †
 regex-dna 
Hack6.072.61220,144832  43% 60% 43% 91%
PHP27.699.58150,456832  64% 60% 67% 100%
 n-body 
Hack568.12568.26117,4841432  8% 45% 0% 48%
PHP698.86699.073,3681082  62% 0% 38% 1%
 k-nucleotide 
Hack135.7342.68353,0001061  86% 99% 66% 69% †
PHP42.5737.50247,8561036  91% 4% 7% 13% †
 reverse-complement 
Hack7.207.22491,796261  53% 4% 0% 45%
PHP5.845.84444,344262  1% 0% 1% 100%
 fannkuch-redux 
Hack1,255.571,255.86117,804532  13% 1% 0% 87% †
PHP2,659.99667.4515,1881150  100% 100% 100% 100% †
 pidigits 
Hack485.10485.28129,820735  22% 16% 6% 58%
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.8.0 (rel)
Compiler: tags/HHVM-3.8.0-0-gbb32f8d645b28561d8491870c44730b9b3f08d35
Repo schema: 74bee5d310450724cfd49245fd6c2e1e4323b10a

Home Page: http://hacklang.org/

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

Revised BSD license

  Home   Conclusions   License   Play