On Sunday 14 October 2007 2:58 pm, Boysenberry Payne wrote:
> I just tried putting the Javascript minifier onto our production
> server since it was working so well on my local development server, and
> I noticed an incredible slow down.
>
> I was wondering if you had a change to look.


I'd be happy to have a look at this with you. I took a quick check at the
URLs you'd sent in your message, though, and didn't see the same slowdown or
hang issue that you did. I'm also -not- seeing the minifier kicking in, so
I'm gathering that for the moment you've turned it off.

I have noticed similar slowdowns on other sites that are using the minifying
filters, depending on how much JavaScript you're trying to minify; stuff like
prototype/script.aculo.us which weighs in at ~250KBytes takes a few seconds
to minify with JavaScript::Minifer.

That said, though, I have been working on XS versions of the JS+CSS minifiers
which should help address performance issues. I've got devel versions here
locally that I've rewritten in XS that are ~200x faster than their pure-Perl
counterparts. I should have both of these whipped into enough shape to be
able to upload devel versions to CPAN within the next 24-48hrs.

> What I've noticed on that js page is it gets to 3.7 k out of 4.6 k
> then hangs for a bit. It seems to do it for each js page.


Can't say that I was able to reproduce this myself, but that could be because
it looks like you've disabled the minifying filter.

> I checked out the server logs and saw this:
> Use of uninitialized value in substitution (s///) at /usr/lib/perl5/
> site_perl/5.8.0/Apache2/Filter/Minifier/JavaScript.pm line 46.
> Use of uninitialized value in exists at /usr/lib/perl5/site_perl/
> 5.8.0/Apache2/Filter/Minifier/JavaScript.pm line 49.


This looks like its in/around the code that does the MIME-Type checking, to
make sure that we're only processing documents with the correct MIME-Type.
If this is 'undef', though, then we're not even finding a "Content-Type"
header in the response in order to figure out what kind of document we've got
and whether or not it can be minified. I'll make sure to add in some extra
tests around this and get a fix rolled in to coincide with the XS minifiers
above, so that you've got something newer to test with.

> I have the following in my httpd.conf file:
> PerlOutputFilterHandler Apache2::Filter::Minifier::JavaScript


Do you have this wrapped in any sort of "", ""
or "" block, or is it just enabled globally? Although it should
work globally (as the internal MIME-Type detection restricts it to only JS
files), you'll probably find things running faster if you only enable it for
specific parts of your site.

E.g.

PerlOutputFilterHandler Apache2::Filter::Minifier::JavaScript


That way we're not even incurring the overhead of MP2 and checking the
MIME-Type of the document unless we've got an idea that it could be JS.

--
Graham TerMarsch
Howling Frog Internet Development, Inc.
--
Graham TerMarsch
Howling Frog Internet Development, Inc.

// -----------------------------------------------------------------
// Some men are discovered; others are found out.
// -----------------------------------------------------------------