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

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 : Are the Hack programs faster? Approximately.

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

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

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

 3 : Are the Hack programs faster? Measurements.

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.0337.07596,756480  1% 0% 0% 100%
PHP634.80635.631,025,300472  0% 0% 0% 100%
 spectral-norm 
Hack57.6614.76141,9801195  98% 98% 98% 98%
PHP446.61113.8524,4081193  98% 97% 100% 98%
 fasta 
Hack26.2926.30328,5201109  0% 1% 0% 100%
PHP133.11136.583,3281030  60% 36% 4% 0%
 mandelbrot 
Hack84.4984.51111,348458  50% 0% 51% 1% †
PHP1,288.37322.44115,808863  100% 100% 100% 100% †
 regex-dna 
Hack7.662.75176,952832  76% 67% 58% 80%
PHP26.249.60151,380832  52% 70% 57% 95%
 n-body 
Hack569.71569.9076,7561432  1% 100% 0% 0%
PHP712.83713.053,3361082  100% 0% 0% 0%
 reverse-complement 
Hack6.456.46449,372294  1% 99% 1% 1%
PHP6.406.41444,376262  0% 0% 0% 100%
 fannkuch-redux 
Hack1,007.571,007.8174,060532  1% 0% 0% 100% †
PHP3,372.33862.7814,9681150  99% 98% 99% 95% †
 k-nucleotide 
Hack128.7139.42289,1561061  87% 95% 72% 75%
PHP53.6519.10248,0441141  65% 66% 70% 82%
 pidigits 
Hack455.38455.5385,072735  1% 1% 54% 47%
PHP2.162.164,280394  1% 0% 0% 100%
 fasta-redux 
No program
PHP0.670.833,5721110  60% 2% 30% 6%

† 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.4.1 (rel)
Compiler: tags/HHVM-3.4.1-0-g5b66f110ebe9bafccecd8946d391b0f895dc107a
Repo schema: bf1db525c412a46f0b4b68c5a5bed52f64183008
Extension API: 20140829

Home Page: http://hacklang.org/

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

  Home   Conclusions   License   Play