abertschi / graalphp

An efficient PHP implementation built on GraalVM
https://abertschi.ch/blog/2020/building-graalphp/
Apache License 2.0
285 stars 13 forks source link

introduce by-reference semantics for arrays #40

Closed abertschi closed 4 years ago

abertschi commented 4 years ago

Deep copying of nested arrays for binary-tree benchmark degrades performance substantially. Zend PHP does assign by reference automatically if semantic of program does not change (as a means of optimization). We introduce PHP & reference operator in order to pass arguments by reference explicitly to achieve similar performance results.

A more clever optimization may apply this enhancement automatically. However, this is not trivial in all cases.

abertschi commented 4 years ago

In order to pass by-ref or by-value, we introduce Forwarding Nodes.

We copy by-value by default. as specified. and introduce by-ref operator for PhpArrays.