Where I work [1] we are thinking about using Protocol Buffers. However we have found that the current perl implementation has some performance issues. There has been at least one message to this list that touches on this:
We are seeing the same issues. Even for smaller messages (12k-20k) we are seeing 5-10 seconds for deserialization. For messages with embedded messages the serialization also becomes very slow.
So I ask: is there currently a plan or idea of how these performance issues can be resolved? If so, what is it?
We are willing to help and at least one of our developers has already submitted a number of patches to this project. Before we commit significant time to this we'd like to know what thought or effort has already gone into resolving these issues.
[1] I am writing from my personal e-mail address, not my work e-mail address, fyi. I work for a company named Oversee.net.
Yeah, it appears that Moose is slow. :-/ Patches welcome, or maybe we need to do a without-Moose rewrite. At least the test suite would be reusable, and probably a lot of the wire-level stuff.
Or perhaps the Moose crew can fix it from their side?
Unfortunately I have about zero time to work on this myself.
On Thu, Sep 18, 2008 at 4:57 AM, Seth Daniel <proto...@sethdaniel.org>wrote:
> Where I work [1] we are thinking about using Protocol Buffers. However we > have found that the current perl implementation has some performance > issues. There has been at least one message to this list that touches > on this:
> We are seeing the same issues. Even for smaller messages (12k-20k) we > are seeing 5-10 seconds for deserialization. For messages with embedded > messages the serialization also becomes very slow.
> So I ask: is there currently a plan or idea of how these performance > issues can be resolved? If so, what is it?
> We are willing to help and at least one of our developers has already > submitted a number of patches to this project. Before we commit > significant time to this we'd like to know what thought or effort has > already gone into resolving these issues.
> [1] I am writing from my personal e-mail address, not my work e-mail > address, fyi. I work for a company named Oversee.net.
On Thu, Sep 25, 2008 at 14:33:33 +0400, Brad Fitzpatrick wrote: > Yeah, it appears that Moose is slow. :-/ > Patches welcome, or maybe we need to do a without-Moose rewrite. At least > the test suite would be reusable, and probably a lot of the wire-level > stuff.
> Or perhaps the Moose crew can fix it from their side?
Yes, most of it is very easy to fix using the same techniques we use to make simple Moose accessors fast.
> Unfortunately I have about zero time to work on this myself.
Likewise in the short term, but I might be able to put some work into it this weekend and probably more later.
I'd be more than happy to help out an interested person on IRC or email.
On Thu, Sep 25, 2008 at 02:33:33PM +0400, Brad Fitzpatrick wrote: > Yeah, it appears that Moose is slow. :-/ > Patches welcome, or maybe we need to do a without-Moose rewrite. At least > the test suite would be reusable, and probably a lot of the wire-level > stuff.
> Or perhaps the Moose crew can fix it from their side?
> Unfortunately I have about zero time to work on this myself.
On Thu, Sep 25, 2008 at 04:02:50PM +0300, Yuval Kogman wrote:
> On Thu, Sep 25, 2008 at 14:33:33 +0400, Brad Fitzpatrick wrote: > > Yeah, it appears that Moose is slow. :-/ > > Patches welcome, or maybe we need to do a without-Moose rewrite. At least > > the test suite would be reusable, and probably a lot of the wire-level > > stuff.
> > Or perhaps the Moose crew can fix it from their side?
> Yes, most of it is very easy to fix using the same techniques we use > to make simple Moose accessors fast.
On Wed, Sep 17, 2008 at 05:57:50PM -0700, Seth Daniel wrote:
> Hello,
> Where I work [1] we are thinking about using Protocol Buffers. However we > have found that the current perl implementation has some performance > issues. There has been at least one message to this list that touches > on this:
> We are seeing the same issues. Even for smaller messages (12k-20k) we > are seeing 5-10 seconds for deserialization. For messages with embedded > messages the serialization also becomes very slow.
I don't have time to help much but I'd be very interested in studying the results of running the code under Devel::NYTProf. If someone could put up the html reports somewhere (or just email a tarball to me) I may be able to help in some way. Even if only to help improve NYTProf to give more insight into the performance of Moose based modules.
On Thu, Sep 25, 2008 at 02:57:29PM +0100, Tim Bunce wrote:
> On Wed, Sep 17, 2008 at 05:57:50PM -0700, Seth Daniel wrote:
> > Hello,
> > Where I work [1] we are thinking about using Protocol Buffers. However we > > have found that the current perl implementation has some performance > > issues. There has been at least one message to this list that touches > > on this:
> > We are seeing the same issues. Even for smaller messages (12k-20k) we > > are seeing 5-10 seconds for deserialization. For messages with embedded > > messages the serialization also becomes very slow.
> I don't have time to help much but I'd be very interested in studying the > results of running the code under Devel::NYTProf. If someone could put > up the html reports somewhere (or just email a tarball to me) I may be > able to help in some way. Even if only to help improve NYTProf to give > more insight into the performance of Moose based modules.
if (ref($class) || !defined($class) || !length($class)) { my $display = defined($class) ? $class : 'undef'; + die if $^S; confess "Invalid class name ($display)"; }
@@ -137,12 +138,14 @@ my $file = $class . '.pm'; $file =~ s{::}{/}g; eval { CORE::require($file) }; + die if( $^S && $@ ); confess "Could not load class ($class) because : $@" if $@; }
# initialize a metaclass if necessary unless (does_metaclass_exist($class)) { eval { Class::MOP::Class->initialize($class) }; + die if( $^S && $@ ); confess "Could not initialize class ($class) because : $@" if $@; }
Essentially an enormous amount of time was spent 'confess'ing. Without this patch deserialization would take *much* longer. A 500k message was taking around 10 minutes to deserialize. With this patch the time went down to 30s for a non-embedded message and 54s for an embedded message. Of course, those times are still really slow.
For comparison the perlxs generator can serialize a 1.5M message in around .04s on my machine.
If you need un-patched results I can provide those easily enough.
On Thu, Sep 25, 2008 at 07:12:52AM -0700, Seth Daniel wrote:
> > I don't have time to help much but I'd be very interested in studying the > > results of running the code under Devel::NYTProf. If someone could put > > up the html reports somewhere (or just email a tarball to me) I may be > > able to help in some way. Even if only to help improve NYTProf to give > > more insight into the performance of Moose based modules.
> http://sethd.org/prof/simple/30s/index.html > http://sethd.org/prof/embed/54s/index.html > Essentially an enormous amount of time was spent 'confess'ing. Without this > patch deserialization would take *much* longer. A 500k message was taking > around 10 minutes to deserialize. With this patch the time went down to 30s > for a non-embedded message and 54s for an embedded message. Of course, those > times are still really slow.
Find some way to avoid calling does() and the performance will be *much* better.
I don't know if anyone on the Moose list is here but it's clear that Moose needs a good sprinkling of caching. Nothing too complex. Invalidate whenever anything structural changes. Just a simple matter of programming.