b26e59a920
We store a bunch of data into an ActRec on the stack, then call a php-level function that calls a C++ function to copy it into an ActRec on the heap. This should hopefully be a little better.
42 linhas
509 B
PHP
42 linhas
509 B
PHP
<?php
|
|
|
|
class CGetM {
|
|
private $x;
|
|
|
|
public function __construct() {
|
|
$this->x = "asdasd";
|
|
}
|
|
|
|
function getX() {
|
|
return $this->x;
|
|
}
|
|
|
|
public function genVarious() {
|
|
$local = $this->getX();
|
|
yield "a";
|
|
yield $local;
|
|
yield "c";
|
|
}
|
|
}
|
|
|
|
function foo() {
|
|
$k = new CGetM();
|
|
$z = $k->getX();
|
|
yield $z;
|
|
yield "\n";
|
|
}
|
|
|
|
function main() {
|
|
foreach (foo() as $x) {
|
|
echo $x;
|
|
}
|
|
|
|
$blah = new CGetM;
|
|
foreach ($blah->genVarious() as $x) {
|
|
echo $x;
|
|
}
|
|
}
|
|
|
|
main();
|
|
echo "\n";
|