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

† 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.1037.14637,956480  1% 8% 2% 94%
PHP604.84605.711,021,744472  38% 22% 42% 0%
 spectral-norm 
Hack59.9717.95117,8441195  81% 93% 80% 82%
PHP500.25126.5623,5161193  99% 99% 99% 99%
 fasta 
Hack26.4226.43116,3921109  1% 0% 100% 1%
PHP116.02116.053,3681030  0% 1% 100% 0%
 mandelbrot 
Hack76.3076.33116,468458  1% 0% 0% 100% †
PHP1,216.19305.00115,240863  100% 100% 100% 100% †
 regex-dna 
Hack6.132.45209,788832  71% 51% 57% 75%
PHP27.699.58150,456832  64% 60% 67% 100%
 n-body 
Hack609.53609.70116,4441432  52% 24% 4% 21%
PHP698.86699.073,3681082  62% 0% 38% 1%
 k-nucleotide 
Hack143.2743.14346,7321061  86% 95% 80% 72% †
PHP42.5737.50247,8561036  91% 4% 7% 13% †
 reverse-complement 
Hack6.846.85488,792261  0% 47% 54% 1%
PHP5.845.84444,344262  1% 0% 1% 100%
 fannkuch-redux 
Hack1,243.001,243.35114,620532  0% 84% 16% 2% †
PHP2,659.99667.4515,1881150  100% 100% 100% 100% †
 pidigits 
Hack477.91478.07126,972735  18% 0% 30% 54%
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.7.1 (rel)
Compiler: tags/HHVM-3.4.1-0-g5b66f110ebe9bafccecd8946d391b0f895dc107a
Repo schema: be14a89778f35ca7f7dd4aca7fff0793e8ae3334

Home Page: http://hacklang.org/

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

Revised BSD license

  Home   Conclusions   License   Play