Skip to main content
Go to the home page of the European Commission (opens in new window)
English English
CORDIS - EU research results
CORDIS

Complete and optimize the PeachPie compiler technology to be fully compatible with the PHP language in order to increase the performance of up to 80% of the internet.

Periodic Reporting for period 1 - PCHP (Complete and optimize the PeachPie compiler technology to be fully compatible with the PHP language in order to increase the performance of up to 80% of the internet.)

Reporting period: 2019-02-01 to 2019-05-31

As companies grow, they tend to maintain various legacy applications that often cause security threats or performance bottlenecks, and frequently prevent a full utilization of modern technologies and practices. Many legacy applications are written in PHP, a popular programming language that powers roughly 80% of all websites today. While the language is widespread, easy to learn, and surrounded by a vast ecosystem, its design poses security risks and slows down the applications’ performance. On the opposite end of the spectrum stands the .NET Framework – a robust, yet complex, language, offering enterprise-grade security and performance. Although a substantial percentage of companies have applications written both in PHP and .NET, integrating the two technologies is generally a complex task leading to significant processing overhead. Moreover, PHP cannot be processed on multiple processor threads in parallel, leading to a significantly higher energy consumption compared to, for example, C#, which is the most popular .NET language.

Our open source technology PeachPie translates PHP to the significantly faster and more secure .NET Framework, allowing for a native integration of the two technologies, substantial performance increases and a mitigation of many common security vulnerabilities preeminent in the PHP language. Using PeachPie, companies can modernize their legacy PHP applications without having to rewrite them, keeping all the business logic intact. Our technology enables developers to interoperate between the two languages, choosing whichever one best fits their use case, speed up their PHP applications and debug their code with powerful diagnostics. Additionally, PeachPie opens up future-proof technologies to PHP developers that are otherwise not accessible to them, such as blockchain, ML, AI or mobile application development. PeachPie allows PHP developers to program applications for a target market otherwise not accessible to them and to create robust enterprise-grade programs. Conversely, our technology enables a .NET developer to re-use the plethora of existing PHP libraries and applications instead of having to write the code from scratch, increasing their operational efficacy. We designed our core algorithms in such a way that they are extensible to other languages as well, and we plan on enhancing PeachPie with the support for the Java language in the future.

The impact on the broader society should at least a portion of the overwhelming market share of PHP websites transition to PeachPie and .NET could be significant. Given that PHP consumes roughly 10 times more energy compared to .NET, the electricity used to power a large portion of the internet could be reduced substantially by switching to our technology.
From our original work package, following were the three main objectives of the Feasibility Study:
1. Develop the missing functions within PeachPie in order to compile a broader range of popular PHP applications
2. Implement performance optimizations to improve the speed and memory usage of the technology
3. Perform market research in order to verify our business model and development direction

Development:
To work around missing functions or implement them as needed in order to successfully compile the given framework or application.

Wordpress Compile and publish as NuGet Finished 02/19
Drupal Compile Finished 04/19
Laravel Compile Finished 05/19
Magento Compile Finished 04/19
WooCommerce Compile Finished 04/19
Prestashop Compile Finished 05/19
Symfony Compile Finished 05/19
Nette Not originally in scope Finished 05/19

Performance Optimizations:
Improve compile-time and runtime measurements, as well as memory usage

Array structures Optimize usage of array structures Finished 01/19 - 40% decrease in memory usage
Semantic transformations Optimize semantic transformation model Finished 01/19 - 10-50% increase in AST transformation efficiency**
Runtime Implement new APIs; clean up runtime Finished 05/19 for validation purposes, resulting in 40% performance improvements. To be continuously ongoing.

Market validation:
Conduct market research to validate the size of the opportunity and determine the product-market fit.

1. Technology
Validate usefulness online and on conferences
Overwhelmingly positive feedback during our presentations at IT conferences and a 25% increase in our user base since the start of our market validation, reaching 20,000 users and 51,000 pageviews over the feasibility study timespan.
2. Market opportunity
Understand which applications to pursue commercially
We researched & validated total addressable global market size to be 30B Euro derived from approx. 1.2B sites written in PHP, of which 5% relate to our target segment, at an average annual value per site of 500 Euro. In the e-commerce sector alone, there are roughly 800,000 e-shops in Europe, of which roughly 50% are written in PHP. At an average annual value per client of 500 Euro, the serviceable addressable market thus amounts to 200 million Euro. Our focus will be on applications such as Drupal, Magento and WooCommerce (sites with higher propensity to pay).
3. Execution
Evaluate GTM strategy with EU coach and advisors
Leverage enterprise sales early to generate positive cash flow, while designing a scalable SaaS product, and combine Cloud Hub and bundled products into a unified offering. Reach potential clients through community, digital agencies, fairs and direct sales. We validated our target segment to be mainly e-commerce companies, digital agencies, media houses, as well as freelance developers and the open-source community, for which we will provide a set of tools to spread the technology.
From a technological standpoint, there is currently only one project that can, to a certain extent, also compile PHP - HipHop Virtual Machine, or HHVM. This technology was developed by Facebook, a website written in PHP, to bypass the site’sperformance struggles due to its increasing user base. What was then called HPHPc transpiled PHP to C++ code, which also offered a just-in-time (JIT) compilation mechanism and faster runtime possibilities, similar to .NET. Over the years, Facebook created its own extension to the PHP language - Hack - and changed the architecture of its compiler to create a JIT-based PHP virtual machine, akin to the virtual machine that runs the Java language. Facebook switched from HPHPc to HHVM in 2013 and has been running on the new compiler ever since. However, in September 2017, the company officially announced that it would no longer support PHP and will instead focus only on Hack. As a result, future improvements and changes to the PHP language will no longer be compatible with HHVM, and it would be a very problematic endeavor for Facebook to restart its support for PHP in the future. It is important to mention that the objective of HHVM is strictly to provide a performance increase over regular PHP, and no other benefits are offered, e.g. interoperability or added security. Another project that has attempted to approach this issue in the past was J-PHP, which can run PHP code on the Java virtual machine; however, it doesn’t aim to replace the Zend runtime, and therefore cannot be compatible with existing PHP applications. The project is no longer in active development as of May 2019.
Aside from the fact that PeachPie will continue to support future versions of PHP, and can also parse its past versions, there are a number of technological advantages to our approach compared to that of HHVM by Facebook. Firstly, PeachPie compiles PHP code to common intermediate language (CIL) bytecode, which is a standardized bytecode used by all .NET languages, rather than creating a proprietary high-level bytecode, as Facebook has. As a result, PeachPie provides a full bi-directional interoperability of PHP and any .NET language (C#, F# or VB.NET). Furthermore, PeachPie allows for PHP code to be executed on the Common Language Runtime (CLR), targeting Microsoft’s .NET Standard. This crucial feature allows PeachPie to target the full .NET Framework, Xamarin applications, ASP.NET .NET Core, ASP.NET Core and Mono. Hence, PeachPie enables PHP code to be executed across any platform, device or operating system. Finally, the .NET Core and ASP.NET Core platforms’ lightweight architecture combined with the open-source Kestrel web server provide one of the fastest runtime environments of any current setup, with most benchmarks ranking these platforms among the highest in performance in throughput. Consequently, targeting these new frameworks, whose performance is being improved consistently by Microsoft, imply that PeachPie will outperform HHVM by a large margin in terms of execution speed, particularly in high user concurrency settings.

While the technology itself stands practically without competition, our intended products and certain use cases of the technology, each have distinct viable alternatives. For example, our code analysis, which reveals bugs and security vulnerabilities ahead of launching the product, will compete with some of the well-established projects on the market: PHPStan, a command-line tool that checks for a pre-defined set of errors, exakat.io a SaaS-like platform and RIPS, an online automated security testing platform. When it comes to static analysis, which reveals errors security threats in the code, we have a much greater level of detail in our code analysis algorithm than would ever be possible with any external tool, which can only skim the surface. PeachPie’s code analysis, on the other hand, scans the very core of an application to its most atomic level, providing the most comprehensive level of detail. As of May 2019, PeachPie can already report all checks performed by PHPStan. Furthermore, our extensions into popular development environments allow for all of these diagnostics to be available right in the editor where the code is being programmed, instead of having to use a command line or online tool.
Exakat and RIPS both compete with one aspect of our Cloud Hub product, which is a PaaS-based continuous diagnostics and testing service. There are three major differentiating points compared to the aforementioned products. Firstly, the amount of detail our diagnostics provide go far beyond those that can be performed with external tooling, since static analysis tools only utilize syntactic analysis, whereas PeachPie builds a semantic code representation, which is constantly being enriched by low-level data from the code. PeachPie’s code analysis is able to consistently enrich the program’s code flow with information about its symbols, types, links between individual modules and complex patterns emerging within the code.
Secondly, our solution enables a PHP developer to package their project into a .NET NuGet component and sell it on our marketplace. The main benefits of such a step are that the source code is heavily obfuscated and in fact distributed without the original sources, which is a significant security enhancement. Furthermore, we allow for our continuous testing to be set up on premise, should a client prefer this option. Lastly, unlike exakat.io and RIPS, we also provide runtime application performance monitoring (APM). In order to perform those, we can take direct advantage of Microsoft’s AppInsights tool on Azure, which provides detailed application telemetry. This service then provides state-of-the-art performance monitoring, live exception supervision with the possibility of automatically filing bug reports, as well as continuous runtime and compilation speed measuring. In this area, we may end up competing with application performance management (APM) software, such as AppDynamics, DataDog, Dynatrace or Zend Server. Aside from Zend Server, however, these applications focus on a wide range of languages and technologies, and they require a developer to change the source code of their application by adding events that measure the performance, whereas our solution can be launched without any changes to the code whatsoever. Additionally, the events are limited in their ability to collect information, while we can zoom in on any granularity we need.

On an enterprise level, the lack of scalability options and significantly higher energy consumption of PHP can represent a crucial factor in a company’s cost structure. As PHP doesn’t possess the ability to process requests on multiple processor threads simultaneously, its energy consumption ranks among the highest of all programming languages (29.3 J compared to the benchmark index of the C language, whereas C# consumes only 3.15 J) . C#, the most widespread of the three .NET languages, therefore consumes significantly less energy compared to PHP, making it by far the greener option among the two languages. Consequently, if we convert a PHP website to .NET using PeachPie, we effectively lower that site’s energy consumption by almost 90%. Given that over three quarters of all internet sites run on PHP, the potential implications of our technology if it were to gain more widespread usage are particularly significant for the environment. Given that data centers are expected to account for 20% of the world’s electricity usage by 2025, the potential impact of migrating as large a portion of PHP sites to .NET using PeachPie could be substantial.
My booklet 0 0