Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52482 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 91061 invoked from network); 20 May 2011 16:12:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 May 2011 16:12:47 -0000 Authentication-Results: pb1.pair.com smtp.mail=larry@garfieldtech.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=larry@garfieldtech.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain garfieldtech.com from 66.111.4.28 cause and error) X-PHP-List-Original-Sender: larry@garfieldtech.com X-Host-Fingerprint: 66.111.4.28 out4.smtp.messagingengine.com Received: from [66.111.4.28] ([66.111.4.28:57505] helo=out4.smtp.messagingengine.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0E/62-12578-EF296DD4 for ; Fri, 20 May 2011 12:12:47 -0400 Received: from compute1.internal (compute1.nyi.mail.srv.osa [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id 7AB472063D for ; Fri, 20 May 2011 12:12:44 -0400 (EDT) Received: from frontend1.messagingengine.com ([10.202.2.160]) by compute1.internal (MEProxy); Fri, 20 May 2011 12:12:44 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:date:from:mime-version:to:subject:content-type:content-transfer-encoding; s=smtpout; bh=21rMF0j7CaC/XqBulWWvIy3e7d0=; b=SWX1aZbPIN8H+ezgD1WX4RQGNTRNcwkXiL0LqEL8xidQ21dsMvNgCXVM+REBLZKTJY+yR75GmoZAIrM0jBsHK9GNO1dLKwt2Hb81SypWD4BPB/kq6oIFTJ5tnMXCw+GGeoe95Ikc6zAjB7FJUKVKK/5UJtPdBT9OHM59N2kwVHM= X-Sasl-enc: BH6/Mb5WCyBumoCLd3RfJ0ja+Urh8lASL1qlW7l2DoEt 1305907964 Received: from linux-nkec.site (nat-portal-160-94-47-16.uofm.wireless.umn.edu [160.94.47.16]) by mail.messagingengine.com (Postfix) with ESMTPSA id 2CD044023E6 for ; Fri, 20 May 2011 12:12:44 -0400 (EDT) Message-ID: <4DD693BB.7030300@garfieldtech.com> Date: Fri, 20 May 2011 11:15:55 -0500 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110414 SUSE/3.1.10 Thunderbird/3.1.10 MIME-Version: 1.0 To: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Porting PECL to userspace From: larry@garfieldtech.com (Larry Garfield) 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. 2) Is anyone else doing this? No sense doing it ourselves if someone else already is. 3) What would be the cleanest way to do so? We had the thought of partially automating the process by having PHP auto-generate at the very least the subs of any classes and functions that the module provides. However, when my colleague tried using the same parser as is used for generating documentation he says he got several times as many classes as the manual says the module has. We were using the PECL HTTP module as our sample (http://www.php.net/http). (I don't know the exact details of what he did at the moment.) Is that not a viable approach? Would we be better off using reflection? Is there some other tool we're not aware of? If viable I'd love if this would start a trend, but we'll see where it goes. I know it wouldn't work for all PECL modules, obviously, but I suspect it could work for several, and provide an easy way for different PHP projects to share backend code without needing lots of C developers. --Larry Garfield