Re: phpng: Refactored PHP Engine with Big Performance Improvement

From: Date: Mon, 05 May 2014 19:31:27 +0000
Subject: Re: phpng: Refactored PHP Engine with Big Performance Improvement
References: 1  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
Hi again,

> ...

It's been brought to my attention that in my previous comparison, there were
also two skipped tests I'd overlooked, I've commented them so we're actually
comparing apples with apples. Also, I got a couple more tests working, so here
we go:

5.5
OK: 2987/3013 run (26 skipped), 2987 succeeded, 0 failed
Memory used: 37065.45 kB (37350.91 kB peak)
Time taken: 2.133 seconds

phpng
OK: 2987/3013 run (26 skipped), 2987 succeeded, 0 failed
Memory used: 29315.42 kB (29583.73 kB peak)
Time taken: 1.603 seconds

> (I’ll have a look into these and try to figure out what’s going on)

Here's my summary of why there are failing tests (all of these work fine with
5.4, 5.6-beta2, 5.7-dev-master). I've tried fixing them but haven't succeeded,
but I thought I'd tell you anyways.


1) Process control functions
============================
proc_close() seems to always return exit code 1 regardless of the actual exit
code:

$ ./sapi/cli/php -r '$p= proc_open("ls -al buildconf", [0 => ["pipe",
"r"], 1 =>
["pipe", "w"], 2 => ["pipe", "w"]], $pipes);
var_dump(fread($pipes[1], 1024));
foreach ($pipes as $pipe) { fclose($pipe); } var_dump(proc_close($p));'
string(54) "-rwxr-xr-x 1 friebe friebe 772 Apr 18 16:21 buildconf
"
int(1)

(should be: 0)

$ ./sapi/cli/php -r '$p= proc_open("ls -ü", [0 => ["pipe",
"r"], 1 => ["pipe",
"w"], 2 => ["pipe", "w"]], $pipes); var_dump(fread($pipes[1],
1024)); foreach
($pipes as $pipe) { fclose($pipe); } var_dump(proc_close($p));'
string(0) ""
int(1)

(should be: 2)

It works fine in both situations if I don't explicitely fclose() all the pipes.

2) Fatal error with DateTime
============================
DateTime::date_timezone_set() must be derived from Date::date_timezone_set in
Unknown on line 0
DateTimeInterface::date_format() must be derived from Date::date_format in
Unknown on line 0

Unfortunately I can't exactly produce a small script to reproduce, but the
Date class mentioned above basically does this:

class Date extends Object {
  public function __construct($in) {
    $this->value= date_create($in, timezone_open(...));
  }
}

These errors are both produced by zend_parse_method_parameters(), where this_ptr
points to the class Date and not to DateTime. I've only seen them
with the
date extension, nowhere else so far. Maybe that helps you.

3) Fatal error: Can only throw objects
======================================
References cause this. The ensure() function prevents uninitialized variable
warnings:

$ ./sapi/cli/php -r 'function ensure(&$e) { if ($e) return true; $e= null;
return false; } $e= new Exception(""); if (ensure($e)) { throw $e; }'

Fatal error: Can only throw objects in Command line code on line 1

Expected outcome:

PHP Fatal error:  Uncaught exception 'Exception' in Command line code:1
# ...

Adding a var_dump($e) right before the throw will actually dump the exception,
so I guess this some refcount issue.

-Timm


Thread (123 messages)

« previous php.internals (#73913) next »