Table of Contents

PHP RFC: Code optimizations

Introduction

According to https://github.com/php/php-src/blob/master/CONTRIBUTING.md, pull requests are only allowed for three things:

This policy does not allow pull requests to do the following improvements to PHP:

Requiring a RFC for each such improvement delays everything by at least four weeks, and adds a lot of bureaucracy. This bureaucracy scares away contributors, and effectively prevents small incremental improvements to the PHP code base.

The following are examples of pull requests that have been mistakenly accepted even though they did not fix a bug nor was there a RFC:

This RFC attempts to establish a framework that allows such improvements.

Proposal

To reduce the barrier for small incremental improvements that are not bug fixes, I propose to allow certain code optimizations without having to go through the RFC process.

By “code optimizations”, I mean both optimized for machines (improving the build process and runtime behavior, e.g. by reducing overhead / resource consumption) and humans (improving code readability and maintainability).

Backward Incompatible Changes

No change to the PHP language, therefore no PHP-level incompatible changes.

Some types of code refactoring may lead to incompatible changes to the internal API at the C level.

Proposed PHP Version(s)

“master” branch.

Ideally, “master” should always be able to merge small incremental improvements.

RFC Impact

To SAPIs

Only if internal C APIs get changed.

To Existing Extensions

Only if internal C APIs get changed.

To Opcache

Only if internal C APIs get changed.

New Constants

Not applicable.

php.ini Defaults

Not applicable.

Open Issues

Unaffected PHP Functionality

The PHP language is completely unaffected.

Future Scope

Not applicable.

Proposed Voting Choices

Primary vote (requires supermajority):

(If the primary vote is declined, then such code changes will continue to be disallowed, and PRs without bugfix and without RFC never be approved.)

Secondary votes (requires simple majority):

Patches and Tests

Implementation

References

Rejected Features