What’s new in PeachPie 0.9.31?

As we make the final preparations before publishing version 1.0, lots of new additions have been made ahead of the latest release of PeachPie. Let’s take a look at what’s new.

Standard PHP Library

In order to support further PHP applications and frameworks, such as Symfony or Laravel, we inevitably had to finish the implementation of the Standard PHP Library (SPL). This tracking issue listed all the different functions and interfaces, and it took a while to complete this, but we’re happy that PeachPie now supports the entire SPL extension. 

Other standard PHP APIs

As the demand comes up, we keep adding lots of further PHP APIs that are regularly used in the PHP language. Some examples include DateTimeZone.getName(), ReflectionMethodmb_convert_case, stream_get_line, and many more. For a full overview of the latest additions, see our changelist.

Compiler Fixes

Release 0.9.31 also includes a bunch of compiler fixes. Some examples include emitting ‘continue’ within ‘do{}while’, a correct emit of abstract methods, as well as producing correct IL for function parameters that have a specified type and a NULL default value.

Generated XMLDoc

PeachPie has been able to generate XMLDoc for a while, but it is now possible for class constructors as well. This makes using compiled PHP classes from within C# even cooler:

XMLDoc for class constructors

Nested Generic Types

We have previously introduced the use of generics in PHP. Now the syntax has been extended to support nested generic types in PHP code, such as:

new \System\Collections\Generic\Dictionary< int, KeyValuePair< string, array > >;

Work on Semantic Trees and Lowering

This is currently being researched and experimented with. Based on our type analysis, flow analysis and compile time expressions evaluation, we are transforming some expressions into something else or something smaller and faster. In release mode, unnecessary code is removed and the compilation is restarted with this reduced code. Additionally, unreachable declarations are completely ignored, so that the resulting IL is smaller and fewer ambiguities happen during runtime (which is good).

This experimental research is a part of our ongoing effort to optimize compile and runtime performance in PeachPie.

Array Optimizations

Another perf optimization has been made in arrays. We recently “switched” to our new implementation of the array structure; in short, we have decreased memory usage by about 40%, while increasing the performance of array operations. More importantly, this allows for even more optimizations in the future.

Here’s an same example of initiating an array of 1M entries:

PeachPie 0.9.26 memory utilization
PeachPie 0.9.31 memory utilization

Next, we will likely produce a few benchmarks after some additional code cleanup and perf fixes. The huge improvement in process memory utilization is only a stepping stone to even more perf optimizations going forward. In parallel, we are implementing missing constructs as needed. If you are interested in getting an app or framework running on PeachPie, the best way you can get involved is to just get cracking and submit an issue with the exception details if you run into any.

Posted on January 28, 2019, in category Information, News, tags: , , , , , , ,