Hiphop Benchmarks

Overview

Hiphop is Facebook’s PHP compiler. It compiles php source into c++ source. This is my experiment with compiling and running it with a couple of scripts from http://shootout.alioth.debian.org/.

Setup

I’m using a build at c3876a7dcaf1694f7c23232149df3283753ed9f9 from http://github.com/facebook/hiphop-php.git (Sept 8th, 2010).

I was able to build successfully under ubuntu with the help of this document: http://wiki.github.com/facebook/hiphop-php/building-and-installing-on-ubuntu-910.

If for some reason make fails, you’ll need to delete the CMakeCache.txt file and build again once you’ve resolved the build error.

On to the benchmarks…

I’m using GNU time for the benchmarks:

Hardware

# lshw -short
H/W path Device Class Description
========================================================
system System Product Name
/0 bus A8V
/0/0 memory 64KiB BIOS
/0/4 processor AMD Athlon(tm) 64 Processor 3700+
/0/4/5 memory 64KiB L1 cache
/0/4/6 memory 1MiB L2 cache
/0/37 memory 2GiB System Memory
/0/37/0 memory 512MiB DIMM DDR Synchronous 333 MHz (3.0 ns)
/0/37/1 memory 512MiB DIMM DDR Synchronous 333 MHz (3.0 ns)
/0/37/2 memory 512MiB DIMM DDR Synchronous 333 MHz (3.0 ns)
/0/37/3 memory 512MiB DIMM DDR Synchronous 333 MHz (3.0 ns)
/0/100 bridge K8T800Pro Host Bridge
/0/100/1 bridge VT8237 PCI bridge [K8T800/K8T890 South]
/0/100/1/0 display Radeon RV100 QY [Radeon 7000/VE]
/0/100/a eth0 network 88E8001 Gigabit Ethernet Controller
/0/100/f storage VIA VT6420 SATA RAID Controller
/0/100/f.1 scsi0 storage VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE
/0/100/f.1/0 /dev/sda disk 300GB ST3300831A
/0/100/f.1/0/1 /dev/sda1 volume 276GiB EXT3 volume
/0/100/f.1/0/2 /dev/sda2 volume 2941MiB Extended partition
/0/100/f.1/0/2/5 /dev/sda5 volume 2941MiB Linux swap / Solaris partition

Results

Benchmark 1:

Source:
http://shootout.alioth.debian.org/u32q/program.php?test=fasta&lang=php&id=3

n=25,000,000

gtime php fasta.php
User: 278.85 System: 1.39 Elapsed: 6:50.66 68%CPU (0text+0data 30000max)k

gtime ./program
User: 190.81 System: 5.64 Elapsed: 6:58.20 46%CPU (0text+0data 1041840max)k

gtime ./build/program > output.txt
User: 199.91 System: 1.05 Elapsed: 3:21.98 CPU: 99% Memory( Avg Res: 0kB Max Res: 1041856kB )

gtime php fasta.php > output2.txt
User: 330.14 System: 1.17 Elapsed: 5:32.78 CPU: 99% Memory( Avg Res: 0kB Max Res: 30000kB )

Both output.txt files are 243MB.

Benchmark 2:

Source:
http://shootout.alioth.debian.org/u32q/program.php?test=binarytrees&lang=php&id=2

n=15

gtime php btrees.php
stretch tree of depth 16 check: -1
65536 trees of depth 4 check: -65536
16384 trees of depth 6 check: -16384
4096 trees of depth 8 check: -4096
1024 trees of depth 10 check: -1024
256 trees of depth 12 check: -256
64 trees of depth 14 check: -64
long lived tree of depth 15 check: -1
User: 40.59 — System: 0.08 — Elapsed: 0:40.89 — CPU: 99% — Max Res Memory: 312944kB

gtime build/program
stretch tree of depth 16 check: -1
65536 trees of depth 4 check: -65536
16384 trees of depth 6 check: -16384
4096 trees of depth 8 check: -4096
1024 trees of depth 10 check: -1024
256 trees of depth 12 check: -256
64 trees of depth 14 check: -64
long lived tree of depth 15 check: -1
User: 9.86 — System: 0.06 — Elapsed: 0:09.98 — CPU: 99% — Max Res Memory: 237152kB

Summary

In benchmark 1, Hiphop performed similarly when outputing to the shell, but was 65% faster when output was piped to a file. However, it consumed 3500% more memory than its php counterpart.

In benchmark 2, Hiphop was 411% faster and consumed 75% of the memory that the php version did.

Future Considerations

Hopefully I’ll be able to add more benchmarks as time goes on. Hiphop is still very young and unstable; though, it does show promising results even now.

Leave a Comment