• Stars
    star
    283
  • Rank 146,066 (Top 3 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 4 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

An efficient PHP implementation built on GraalVM

Build Status codebeat badge CodeFactor Codacy Badge

A PHP implementation built on GraalVM

Graalphp is an experimental just-in-time (JIT) compiler and runtime for PHP 7.4+ hosted on GraalVM.

Abstract

PHP is a popular, weakly typed, general purpose programming language. Originally designed for building dynamic web pages, the language has since gained wide adoption in server-side web development. In this work, we describe the design and implementation of graalphp, an experimental compiler and runtime for PHP hosted on Truffle and GraalVM. GraalVM is a virtual machine that supports execution of multiple languages, which are implemented as Abstract Syntax Tree (AST) interpreters based on Truffle. GraalVM uses Graal as its JIT compiler to compile frequently executed code fragments to machine code. We implement a subset of the PHP language to run synthetic benchmarks by The Computer Language Benchmarks Game. We compare peak performance of our implementation against PHP 7 as well as alternative implementations such as HHVM, JPHP and an early alpha version of PHP 8. Experimental results indicate that our runtime reaches competitive results with performance gains of up to 859% compared to PHP 7. These preliminary results suggest that a Truffle-hosted PHP implementation might be significantly faster than existing language implementations.

design

This project was launched as an undergraduate thesis at ETHZ.

Build and Run

For a container image with development and benchmark dependencies see ./docker/.

# Build Dependencies: Linux environment, maven, ant, GraalVM
# download GraalVM from https://github.com/graalvm/graalvm-ce-builds/releases
$ export JAVA_HOME=/path/to/graalvm
$ mvn package
$ ./graalphp <php-file.php>
# build native image:
$ export JAVA_HOME=/path/to/graalvm
$ $JAVA_HOME/bin/gu install native-image
$ export GRAALPHP_BUILD_NATIVE="true"
$ mvn package

Feature Set

High Level Overview of implemented features, current runtime code base. ca. 4000 LOC. Implemented features are chosen to support execution of the Computer Language Benchmark Game. https://github.com/abertschi/graalphp/tree/master/benchmarks/evaluation

Non exhaustive list of features:

  • Datatypes: int, float, boolean, arrays (sequences) of these types
  • Unconditionally defined functions
  • Variables in function scope, global scope
  • Binary, unary, operations
  • while, do while, for, if

More Resources

More Repositories

1

ad-free

A modularized audio ad blocker for Android
Kotlin
274
star
2

water-me

Don't forget to water your plants.
Dart
53
star
3

postcard_creator_wrapper

A python wrapper around the Rest API of the Swiss Postcard creator 📮
Python
52
star
4

postcards

A CLI for the Swiss Postcard Creator 📮
Python
36
star
5

sailfish-wlan-keyboard

Use your computer keyboard as input device on SailfishOS
C++
21
star
6

postcard-love

Say hi and send me a physical postcard for free
Python
6
star
7

userspace-threading

C
5
star
8

sysequal

Launch Android's builtin Equalizer
Kotlin
5
star
9

flash-on-visit

Get visual feedback on your website traffic 🔦
CSS
3
star
10

sailfish-reload

auto refresh feature for QML prototyping on SailfishOS
JavaScript
3
star
11

stacktrace-unserialize

Java StackTrace as String to java.lang.Throwable
Java
3
star
12

toggle-ninja

Remote toggle features on your Android phone 📡
CSS
3
star
13

sailfish-headless-keyboard-dbus

DBus Service to control keyboard of SailfishOS
QML
2
star
14

arquillian-service-call-tracker-extension

JBoss Arquillian Extension for service-call-tracker
Java
2
star
15

michael-slack-notify

JavaScript
2
star
16

auto-web-auth

This piece of software autoconnects a web authentification based wireless-network
Java
2
star
17

eclipse-pdt-parser-fatjar

PHP
1
star
18

soundfish

Soundcloud port for SailfishOS
1
star
19

sailfish-headless-keyboard

Headless keyboard layout for Sailfish OS
QML
1
star
20

setjmp

hand-knitted try/catch mechanism for c using setjmp.h
C
1
star
21

laptop_sync

A simple set of bash scripts to push backup a laptop to a remote machine using rsync.
Shell
1
star
22

create-url-shortcut

Create an URL shortcut file
JavaScript
1
star
23

arquillian-extension-aspectj

JBoss Arquillian extension for AspectJ
Java
1
star
24

abertschi.ch

Vue
1
star
25

ad-free-resources

1
star
26

create-url-shortcut-cli

JavaScript
1
star
27

abertschi-oss-parent

maven parent pom for ch.abertschi
1
star
28

service-call-tracker

A method call marshaller for Java 🔄
Java
1
star
29

memory-lane

Share life stories with videos 🎬
Java
1
star
30

my-daily-self

Java
1
star
31

omelette-sync

Encrypted cloud storage synchronization
JavaScript
1
star
32

notiplay

Kotlin
1
star
33

syncopoli

upstream: https://gitlab.com/fengshaun/syncopoli/-/merge_requests/23
Java
1
star