Showing posts with label hhvm. Show all posts
Showing posts with label hhvm. Show all posts

2015-02-03

Old String CombSort Benchmark

this is old benchmark, you can find updated result here.

2015-01-26

PHP/HHVM vs Go vs NodeJs BubbleSort Benchmark

So, I wonder about how good HHVM now, the code was taken from this post. My setup is 64-bit Linux 3.18.2-1, AMD A8-6600K, 16 GB RAM, Non-SSD disk, here's the best result of each implementation:

PHP 5.6.4

$ time php bench.php 
Array
(
    [0] => 1
    [1] => 1
    [2] => 2
    [3] => 3
    [4] => 3
    [5] => 4
    [6] => 5
    [7] => 12
    [8] => 52
    [9] => 92
    [10] => 424
    [11] => 4124
)
2.3711581230164
real    0m2.383s
user    0m2.373s
sys     0m0.010s

HHVM 3.5.0

$ time hhvm -v Eval.Jit=true bench.php 
Array
(
    [0] => 1
    [1] => 1
    [2] => 2
    [3] => 3
    [4] => 3
    [5] => 4
    [6] => 5
    [7] => 12
    [8] => 52
    [9] => 92
    [10] => 424
    [11] => 4124
)
0.13958597183228
real    0m0.414s
user    0m0.247s
sys     0m0.033s

Go 1.4.1
And yes, I include the compile time also for fairness.

$ rm bench; time(go build bench.go && ./bench)
removed ‘bench’
[1 1 2 3 3 4 5 12 52 92 424 4124]
23.027575ms
real    0m0.191s
user    0m0.150s
sys     0m0.033s

$ time ./bench 
[1 1 2 3 3 4 5 12 52 92 424 4124]
22.757741ms
real    0m0.024s
user    0m0.023s
sys     0m0.000s

NodeJS 0.10.35

$ time node bench.js
[ 1, 1, 2, 3, 3, 4, 5, 12, 52, 92, 424, 4124 ]
42

real    0m0.065s
user    0m0.060s
sys     0m0.003s

From what we could see (run duration - actual duration):
Go: 22ms - 24ms
NodeJS: 42ms - 65ms
Go (with compile duration included): 23ms - 191ms
HHVM: 139ms - 414ms
PHP2371ms - 2383ms

2014-07-28

Installing HHVM on Ubuntu or ArchLinux

As we already know, HHVM is the fastest PHP interpreter/JIT-compiler for 64-bit systems. To install HHVM on Ubuntu, the easiest way is use the PPA using these commands:

# install HHVM repos' public key
wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add -

# add HHVM repos
echo deb http://dl.hhvm.com/ubuntu trusty main | sudo tee /etc/apt/sources.list.d/hhvm.list

# update list of available software
sudo apt-get update

# install hhvm
sudo apt-get install hhvm

Or when using archlinux, use yaourt command (warning: this would compile the hhvm package, that requires about ~1 hour and more than 2GB of RAM, so add a virtual memory if your RAM not big enough)

sudo yaourt --needed --noconfirm -S --force hhvm

As we already know, since PHP 5.4, PHP can be used without installing any webserver (Apache, Nginx, IIS), use this command to run built-in web server on localhost:8083:

hhvm -m server -p 8083
mapping self...
mapping self took 0'00" (18015 us) wall time
loading static content...
loading static content took 0'00" (0 us) wall time
page server started
all servers started

or when using standard PHP:

php -S localhost:8083
PHP 5.5.15 Development Server started at Mon Jul 28 20:48:06 2014
Listening on http://localhost:8083
Document root is /tmp
Press Ctrl-C to quit.