Re: [PHP-DEV] Porting PECL to userspace

2011-05-21 Thread David Muir
On 21/05/11 01:15, Larry Garfield wrote:
> Hi all.
>
> I'm working with a fellow developer on an experimental project.  There
> are some PECL modules that we want to try and use in an open source
> project where we cannot guarantee that PECL modules will be available,
> since it's intended for widespread distribution on both shared hosts
> and custom hosting. The thought we had was to do a user-space port of
> the PECL module to include in the project and rely on that.  Then if
> the PECL module is installed, we don't include the library (either via
> an extension_loaded() check or just relying on autoload) and the PECL
> implementation gets used instead.  Poof, nice speed boost.
>
> The questions I have are:
>
> 1) Is this even a viable approach?  It seems like it, but to my
> knowledge no one else has done this to any serious extent which makes
> me wonder if there's a reason the road less traveled is less traveled.

One reason would be because it requires fixing bugs and implementing
features twice, so it effectively doubles the required work.

>
> 2) Is anyone else doing this?  No sense doing it ourselves if someone
> else already is.

There's a Drupal extension that does something like this, but in reverse:
http://drupal.org/project/drupal_php_ext

Cheers,
David

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [PATCH] arithmetic speedup

2011-05-21 Thread Martynas Venckus
On 5/21/11, Sebastian Bergmann  wrote:
> On 05/20/2011 11:28 AM, Dmitry Stogov wrote:
>> The bench.php gets more than 10% speedup (2.5 sec instead of 2.9 sec)
>> Real-life applications are not affected. All the PHPT tests are passed.
>
>   I chatted with Kore Nordmann, the creator of Image_3D (raytracer written
>   in PHP) and ezcGraph (chart component in the Zeta Components library)
>   last night. His code will definitely benefit from these improvements.
>
>   Another performance improvement with regards to math functionality in
>   PHP could be compiling math functions such as abs() into specialized
>   opcodes thus alleviating the function call overhead that is otherwise
>   incurred. Kore mentioned, for example, that Xdebug and KCacheGrind
>   currently show that most time is spent in several hundred thousand calls
>   to abs() while running the component's test suite.

What platform was that on?  GCC already inlines its builtins by
default (even at -O0).  I.e., the abs() generates the following code:

   movl-4(%rbp), %eax
   movl%eax, %edx
   sarl$31, %edx
   movl%edx, %eax
   xorl-4(%rbp), %eax
   subl%edx, %eax

I think it's wrong to do the md inlines in PHP itself for couple reasons:

   - There's a huge list of such md functions;  esp. the fp ones
would show bigger benefits.  However inlining each one of them is
infeasible.

   - The inlines are platform-dependent, so this would only
benefit a few platforms.

   - It is generally a wrong level to do such optimizations--this
is a compiler's job.

If your profiling shows that there's a function worth a md inline and
compiler doesn't already do that, submit a bug for your compiler
vendor.  (-;

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [PATCH] arithmetic speedup

2011-05-21 Thread Stas Malyshev

Hi!


What platform was that on?  GCC already inlines its builtins by
default (even at -O0).  I.e., the abs() generates the following code:


As I understand, Sebastian wasn't talking about inlining C abs(). He was 
talking about converting PHP abs() (which is a function call right now 
with all overhead that this implies) to an opcode, which makes it 
somewhat cheaper to call, since the engine will be handling it without 
the overhead associated with PHP function call.


--
Stanislav Malyshev, Software Architect
SugarCRM: http://www.sugarcrm.com/
(408)454-6900 ext. 227

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] [PATCH] arithmetic speedup

2011-05-21 Thread Martynas Venckus
On 5/21/11, Stas Malyshev  wrote:
> Hi!
>
>> What platform was that on?  GCC already inlines its builtins by
>> default (even at -O0).  I.e., the abs() generates the following code:
>
> As I understand, Sebastian wasn't talking about inlining C abs(). He was
> talking about converting PHP abs() (which is a function call right now
> with all overhead that this implies) to an opcode, which makes it
> somewhat cheaper to call, since the engine will be handling it without
> the overhead associated with PHP function call.

That probably makes sense.

The original diff had optimizations using x86 assembler;  this mislead me.  (-;

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] CRL file parsing

2011-05-21 Thread Ricardo Maia
I need to parse a CRL (Certificate Revocation List) file and verify if a
client certificate has been revoked, but the PHP OpenSSL extension do not
support this feature.

I saw a patch for this issue dated from 2007
http://bugs.php.net/bug.php?id=40046
http://pecl.php.net/~pierre/ext-openssl-crl.patch
http://mbechler.eenterphace.org/blog/uploads/ext-openssl-crl.patch

Somebody have news about this issue?

Has a workaround, like a external program call with exec() or system() ?

I'm thinking about a command line program like this 'openssl crl -inform DER
-text -noout -in mycrl.crl'. So, parse the output and find the serial number
of client certificate.

Thanks,
Ricardo Maia (Brainfork)


[PHP-DEV] Constructor object instance dereferentiation

2011-05-21 Thread dukeofgaming
Hi,

I was wondering if object dereferentiation after constructor call is
something that has been discussed already. This is, being able to do
something like:

new MyClass()->setSomething();

Instead of:

$var = new MyClass();
$var->setSomething();

Regards,

David Vega