Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:47409 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57659 invoked from network); 18 Mar 2010 17:50:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Mar 2010 17:50:25 -0000 Authentication-Results: pb1.pair.com header.from=ben.demott@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=ben.demott@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: ben.demott@gmail.com X-Host-Fingerprint: 209.85.160.42 mail-pw0-f42.google.com Received: from [209.85.160.42] ([209.85.160.42:48212] helo=mail-pw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C1/53-20429-0E762AB4 for ; Thu, 18 Mar 2010 12:50:25 -0500 Received: by pwj8 with SMTP id 8so2004201pwj.29 for ; Thu, 18 Mar 2010 10:50:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=zenVyPo8fsSk5ndFNGJgyvg5HLaIVVwfldnD3BndOG8=; b=bfwTy8bfh/wOTWW5jdCYxdv1iUKk7pNOEb8khiUaAGofojs/jph3m3ipCYSz7/pSl2 2vzMznUoMK0buIDDiZuqKAsy0zulSNX1vXRjGsnMyE+QHpSE0jS52QN5JlMxsnBCAxqN DDfvx5MQjT8kQjAgW8mpX0ojiGQlwtEz7aZHw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=tUTwbGNC/3kuh6vI5NKHXPR4ksMhO9XaU8BR9wIF6pI8z0ea6sXGuam30pcirfX6pK Mrnbsr55OPBAeP3MVF1Xm3C/0qhor2nlBP4HDz1m74Pot7vatxbibUGUjny5rZ+puhae wEvl0P/m5C53kdeBm4jgqIbFJiRk7fIbiDobI= MIME-Version: 1.0 Received: by 10.142.55.17 with SMTP id d17mr1441999wfa.246.1268934609336; Thu, 18 Mar 2010 10:50:09 -0700 (PDT) In-Reply-To: References: <56.96.20429.EC352AB4@pb1.pair.com> <99828cd71003180955k48ae834flb8ad2c55b5001692@mail.gmail.com> Date: Thu, 18 Mar 2010 13:50:09 -0400 Message-ID: <99828cd71003181050m49aa2cc3s336cd5a066a59af@mail.gmail.com> To: Derick Rethans Cc: PHP Developers Mailing List Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] PHP Variable Storage / DBUS From: ben.demott@gmail.com (Ben DeMott) I'll keep it short and sweet Derick ! =3D] http://opensource.dynamoid.com/ -> Is exactly what I was thinking of, glad I asked so I am not re-inventing the wheel :) I have a feeling I can get educated really fast on php data-type internals by taking a look at the source. Thanks again! On Thu, Mar 18, 2010 at 1:22 PM, Derick Rethans wrote: > On Thu, 18 Mar 2010, Ben DeMott wrote: > >> So is the data structure thats being serialized remaining in some form >> thats reflective of its binary encoding on the system. Or is there >> some byte-encoding that goes on to generalize the binary structure? > > PHP only knows about binary text, and then numbers and floats. Our > current serialize format is just text based. > >> I guess ... Does it find the values in memory of the distinct values, >> and then create a serialized set of indexes in a c-compatible >> data-type? >> or... is this just another form of string serialization, where >> variables are represented by strings encoded in ASCII? > > The current serializer does do the latter. pecl/dbus does... DBUS > serialization of course. > >> If this is a binary serialization two additional questions: >> 1.) Does this mean that you can to some accuracy determine the size of >> an in-memory variable by counting the sizeof() on the components that >> make up the data-structure in C? > > nope, that won't work as there are strings that are at least two blocks, > and arrays and objects are tons. > >> 2.) Can the PHP sessions serialization be made to use this type of >> serialization - so the serialized values could be shared between >> multiple applications.. (let me give you an example) > > Thereis an igbinary extension/serializer. > >> =A0 =A0 =A0Would I be better off just re-implementing the PHP C code for= its >> session serializer/deserializer in Python than attempting to keep it >> binary? > > What you want... both work. > >> For PHP Sessions, lets say you use memcached to store a serialized >> representation of the session. >> Lets also say that you would like to read that session data >> occasionally by python to offload work that your webserver would >> normally have to perform. >> >> If you were to write a binary serialized form to memory - the C >> implementation of the serialization could by very easily ported to >> Python as an extension and both could be maintained with ease >> (as both PHP and Python are written in C, a Java variant wouldn't be >> too hard either using JNI) > > The problem is that PHP and Python have different dataytpes, and dbus > has yet again others. That is always going to be a problem. > >> I guess this brings up the question of - How hard would it be to >> expose the binary object that dbus sends over-the-wire so it could be >> written to file instead? > > You need a tool such as dbus-monitor, but you need to write the > deserialization from DBUS into your "fileformat" yet again. > >> Overall it would be nice if PHP had a functionality similar to Pythons >> Pickle -> to expose to the user so they could store binary >> representations of objects as they saw fit. >> >> It seems to me this would be vastly more efficient than an >> ascii-encoding and serialization as well. > > That's no different from what serialization does really. There is > http://opensource.dynamoid.com/ for binary serializations. > >> If my logic is poorly formed because of a lack of understanding please >> feel free to educate me! > > You write too much text :P > > regards, > Derick > > -- > http://derickrethans.nl | http://xdebug.org > Like Xdebug? Consider a donation: http://xdebug.org/donate.php > twitter: @derickr and @xdebug >