Welcoming 2021 with Preview5 and WordPress 5.6

To kick off the new year, the compiler and all corresponding libraries were updated, together with the latest build of WordPress 5.6 on .NET. Let’s take a look at how this moves the PHP 8 compatibility along, and what improvements and fixes we’ve made in the latest update.

WordPress 5.6

PeachPie 1.0.0-preview5 improves the performance of array operations and fixes a few issues related to the WordPress codebase. The latest WordPress 5.6 has been compiled into a NuGet package, including the performance and compatibility improvements, entirely ready to be used by an ASP.NET Core application. As always, to run WordPress within an ASP.NET Core app (including the new .NET 5.0 framework), add a reference to the package and use the WordPress middleware within your request pipeline:

dotnet add package PeachPied.WordPress.AspNetCore --version 5.6.0-preview5
public partial class Startup
    public void Configure(IApplicationBuilder app)
        // ...
        // ...

We’ve already updated our website, which has been running on this mechanism for a few years now; this means that we haven’t had any PHP source code or PHP binaries on our server for a while, and we’ve experienced some of the benefits first hand: the site hasn’t had any unscheduled downtime (except for when we had issues with our SSL certificates) and thanks to the ASP.NET Core response caching, we’re benefiting from the performance enhancements significantly.


The update also addresses the performance of our internal array implementation to some extent. PHP code is heavily based on arrays, which are in fact highly performant dictionaries that maintain the order of entries index by either a 64-bit integer or a string. Now we’ve been able to improve the overall performance by about 20%, in some cases by 33%.

$array[123] = $value;
$value = $array[123];

The following chart compares the previous release preview4 with preview5.

To be fair, PHP’s native implementation is still more than 2-times faster. In case you’re interested in the C# implementation, take a look at github.com/peachpiecompiler/peachpie/src/Peachpie.Runtime/OrderedDictionary.cs.

PHP 8 Compatibility

The following, and more, has been implemented in the recent update:

  • ReflectionAttribute – PHP 8 attributes are now parsed and stored as regular CLI metadata. The ReflectionAttribute is fully implemented now, providing access to both PHP and .NET attributes.
  • PhpToken – The new helper class providing a PHP tokenizer and a few helper functions.

Take a look at the compatibility status for the list of not yet implemented PHP functions and extensions.


One of the advantages of PeachPie is the .NET ecosystem and the simplicity of C# language, which allows us to implement extension functions pretty easily and securely. BCMath is a PHP extension based on the “Basic Calculator utility” by Philip Nelson. In PeachPie we have implemented it using the Rationals Nuget package by Tom Pazourek. This internally uses BigInteger as the numerator and denominator to represent a number as a fraction, resulting in greater performance and precision.

PeachPie 1.0.0-preview5 supports the entire BCMath extension.

Posted on January 13, 2021, in category Information, tags: , , , , ,