Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Using HHVM to run PocketMine

Comments in 'General Discussion' started by aliuly, Mar 20, 2015.

  1. aliuly
    Offline

    aliuly Notable Member Plugin Developer

    Joined:
    Feb 8, 2014
    Posts:
    1,086
    Plugins:
    17
    Hello,

    Anybody tried running PocketMine using HHVM? It is a VM that runs PHP and supposedly can achieve better run-time performance.
    Falk likes this.
  2. Falk
    Offline

    Falk Staff Member Global Moderator

    Joined:
    Sep 2, 2013
    Posts:
    1,706
    Plugins:
    22
    Minecraft User:
    Falkirknh
    HHVM is a JIT, meaning that code gets compiled into bytecode and the is executed natively on runtime. Zend PHP compiles everything into opcode and then executes that on a virtual CPU, which is obviously much slower. HHVM doesn't support all the features of PHP yet. I think there would be issues getting all the extensions to run on it, although I haven't tried.
  3. b3builder
    Offline

    b3builder Active Member Plugin Developer

    Joined:
    Oct 6, 2014
    Posts:
    66
    Plugins:
    2
    Minecraft User:
    b3builder
    I'm gonna try this out. They claim to be able of running the top 20 github PHP projects "out of the box" so who knows. PocketMine seems like a very hard-to-run application though given all socket/UDP and file handling that goes on.
  4. shoghicp
    Offline

    shoghicp Staff Member PocketMine Team

    Joined:
    Aug 22, 2013
    Posts:
    433
    Plugins:
    14
    Minecraft User:
    shoghicp
    There is no pthreads support in HHVM, and the zlib extension doesn't handle the data correctly. I've tested with a stripped-down version of PocketMine (that cannot be used for servers) and tested against HHVM and PHP 7, and HHVM lost (after having the code JITd). PHP 7 was much faster for what PocketMine uses.
  5. b3builder
    Offline

    b3builder Active Member Plugin Developer

    Joined:
    Oct 6, 2014
    Posts:
    66
    Plugins:
    2
    Minecraft User:
    b3builder
    Oh, and php7 is faster than the supplied 5.6.4 by how much?
  6. shoghicp
    Offline

    shoghicp Staff Member PocketMine Team

    Joined:
    Aug 22, 2013
    Posts:
    433
    Plugins:
    14
    Minecraft User:
    shoghicp
    150% - 200%, most of the memory and call overhead has been removed. You can also check a table at the bottom of https://wiki.php.net/phpng (it's a different test than PocketMine)
    EvolSoft, PEMapModder and Falk like this.
  7. b3builder
    Offline

    b3builder Active Member Plugin Developer

    Joined:
    Oct 6, 2014
    Posts:
    66
    Plugins:
    2
    Minecraft User:
    b3builder
    [[email protected] ~]$ php -v
    PHP 7.0.0-dev (cli) (built: Apr 8 2015 18:26:28)
    Copyright (c) 1997-2015 The PHP Group
    Zend Engine v3.0.0-dev, Copyright (c) 1998-2015 Zend Technologies

    [[email protected] ~]$ php PocketMine-MP.phar
    [CRITICAL] Unable to find the pthreads extension.
    [CRITICAL] Please use the installer provided on the homepage.

    When trying to compile php7 with pthreads I get the following error:

    /bin/sh /root/php-src/libtool --silent --preserve-dup-deps --mode=compile /root/php-src/meta_ccld -Iext/pthreads/ -I/root/php-src/ext/pthreads/ -DPHP_ATOM_INC -I/root/php-src/include -I/root/php-src/main -I/root/php-src -I/root/php-src/ext/date/lib -I/usr/include/libxml2 -I/root/php-src/ext/sqlite3/libsqlite -I/root/php-src/ext/pthreads -I/root/php-src/TSRM -I/root/php-src/Zend -D_REENTRANT -I/usr/include -g -O2 -fvisibility=hidden -pthread -DZTS -c /root/php-src/ext/pthreads/php_pthreads.c -o ext/pthreads/php_pthreads.lo
    In file included from /root/php-src/ext/pthreads/php_pthreads.c:22:0:
    ext/pthreads/src/pthreads.h:41:40: fatal error: ext/standard/php_smart_str.h: No such file or directory
    #include <ext/standard/php_smart_str.h>
    ^
    compilation terminated.
    make: *** [ext/pthreads/php_pthreads.lo] Error 1


    Did you manage compiling PHP7 with pthreads?

    It would be so great to run PocketMine in php7!! :)

    /b3
  8. shoghicp
    Offline

    shoghicp Staff Member PocketMine Team

    Joined:
    Aug 22, 2013
    Posts:
    433
    Plugins:
    14
    Minecraft User:
    shoghicp
    As I said, it was a stripped-out version of PocketMine without pthreads, or other extensions. It was non usable besides testing :)

Share This Page

Advertisement