You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Jonathan Vanasco <mo...@2xlp.com> on 2006/05/06 06:10:32 UTC
yaml + bindings to other languages
this may make some of you cringe, so i apologize
i've moved over a bunch of image processing and file uploading from a
mod_perl project to the turbogears python framework - i seriously
hate the speed and quality of GD / ImageMagick, and python's imaging
library was better suited to my needs. keeping the imaging and
document handling off of modperl conserved a ton of memory and
resources too, so i'm happy.
the issue came though - how do i transparently handle the switchover
for the users?
the answer:
a- url dispatch proxies the relative urls to python
b- use a cross-language data store for sessions -- which ended up
being yaml.
there already is an apache session flex module for yaml, but it
handles everything via the pure-perl yaml implementation
i patched it to use the syck library if available:
http://dev.2xlp.com/svn/mod_perl/cpan_patches/
Apache::Session::Serialize::YAML/trunk/YAML.pm
the idea was from the JSON::Syck implementation - written by the same
person who wrote yaml, but he's yet to update the official flex::yaml
binding (he was working on a real release last month )
i desperately needed the speed bump ( 30-100x faster than the pure
perl, though still 25-50% the speed of Storable ) - so in case anyone
else in in a similar spot, you can try using the file above.
Re: yaml + bindings to other languages
Posted by Jonathan Vanasco <mo...@2xlp.com>.
On May 6, 2006, at 12:34 PM, Perrin Harkins wrote:
> I recommend using Imager. It's fast and easy to install. Seems to
> be the image library of choice in Perl these days.
I'll give it a shot. Never heard of it before.
> Has anyone benchmarked YAML against XML in Perl? YAML seems to go
> to some trouble to make the output pretty.
There's this
http://idisk.mac.com/christian.hansen/Public/perl/serialize.pl
Here are just the speed marks for those that don't want to click the
link
----
Deflate
Rate
YAML 99.0/s
Data::Taxi 495/s
XML::Simple 875/s
PHP::Serialization 1141/s
JSON 1185/s
RPC::XML 1305/s
YAML::Syck 2372/s
JSON::Syck 2572/s
FreezeThaw 2865/s
Convert::Bencode 3223/s
Storable 4709/s
Convert::Bencode_XS 10751/s
Inflate
Rate
YAML 75.5/s
XML::Simple 195/s
PHP::Serialization 246/s
Data::Taxi 366/s
JSON 449/s
Convert::Bencode 528/s
FreezeThaw 923/s
RPC::XML 993/s
Convert::Bencode_XS 1066/s
YAML::Syck 3140/s
JSON::Syck 3318/s
Storable 16592/s
----
As you can see YAML is indeed slow. But for session (un)
serialization its completely unusable.
I did all of my xmlhhtprequest using the JSON pure perl module, and
felt a big ease on resources when i found that syck module.
Using the syck binding for yaml with session serialization totally
saved me though.
Re: yaml + bindings to other languages
Posted by Perrin Harkins <pe...@elem.com>.
Jonathan Vanasco wrote:
> i seriously hate
> the speed and quality of GD / ImageMagick
I recommend using Imager. It's fast and easy to install. Seems to be
the image library of choice in Perl these days.
> b- use a cross-language data store for sessions -- which ended up
> being yaml.
Has anyone benchmarked YAML against XML in Perl? YAML seems to go to
some trouble to make the output pretty.
- Perrin