On Oct 15, 2007, at 1:47 PM, Graham TerMarsch wrote:

> 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 had to take it down so our clients didn't get effected...
I can put it back up to look at if you'd like for a little bit,
ideally later at night,
or I can just wait until the newer XS version is in cpan, let me know
which you'd prefer...


>
>> 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.


I set the javascript MIME-Type in mod_perl via $r->content_type
( "text/javascript" );

Here is what I have in the httpd.conf file:


SetHandler perl-script
PerlResponseHandler Habitat::Apache2
PerlOutputFilterHandler Apache2::Filter::Minifier::JavaScript
Options +ExecCGI


Also, I only have the version you sent me directly installed on my
local development server,
not the official cpan version. I remember you making changes before
you put the official version up,
so maybe that would explain the local version running differently.
Of course, with one being CentOS
and my local dev being OSX that could be it too...

Anyway, I'm looking forward to using it, and appreciate the response.
I'll look forward to the XS version and plan on letting you know how
it goes.

Thanks again,
Boysenberry Payne