[wp-hackers] Slim WordPress by way of Google Ajax API?
Duane Storey
duanestorey at gmail.com
Thu Jun 5 06:26:50 GMT 2008
Actually, I did a bunch of experimentation with caching and different
browsers a few months ago. Most browsers will not cache files if the
server doesn't properly set the Etags and/or Cache-Control directives.
Most vanilla versions of apache do not do this. This results in a
real request for the files on each page reload.
There's a firefox plugin that let's you view the headers, and on most
web sites I tested with WordPress, pretty much everything was reloaded
while bouncing between pages (since there was no caching information
in the response).
You can manually get around this by adding caching instructions to
your .htaccess file for Apache, which is what I believe Google said
they were going to do for these libraries. For example, here's a head
request for the prototype library from Google:
http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js
HTTP/1.1 200 OK
Last-Modified: Sat, 24 May 2008 00:39:29 GMT
Content-Type: application/x-javascript
Expires: Fri, 05 Jun 2009 06:20:49 GMT
Date: Thu, 05 Jun 2008 06:20:49 GMT
Cache-Control: public, max-age=31536000
Content-Length: 126127
Server: GFE/1.3
Notice the cache-control and expires directives which tells browsers
to cache it and for how long.
I think it's actually a neat idea, but I'd much rather the files be
hosted on WordPress somewhere if possible. And in fact, if WordPress
hosted minified versions and encouraged theme/plugin developers to use
those, it could very well result in a large performance increase
across all WordPress sites that use these libraries in the future,
since the caching benefits would be shared between sites.
On 5/31/08, Andrew Ozz <admin at laptoptips.ca> wrote:
> Eric Marden wrote:
>
> >
> >
> > > So its faster? Hmmm...appealing... :)
> > >
> >
> >
> > This is more anecdotal than authoritative.
> > Numbers. or it didn't happen. ;)
> >
>
> Using this to load the default js libraries in WordPress would probably not
> increase the speed of the admin.
>
> In theory, after the first access all static files, js, css and images, are
> stored in the browser's cache. Next time the page is accessed, these files
> are loaded from the cache. The browser makes requests to the server only to
> check for updated versions.
>
> Since we have Gears now, all these requests are local too. When loading an
> admin page there are only 1-2 requests sent to the server. Using Google Ajax
> API to load js libraries would actually be slightly slower, as the library
> would not be cached in Gears.
>
> On the other hand using the API for loading js on the front pages or in a
> plugin that doesn't use the WordPress defaults would increase the speed for
> the site's visitors and also reduce bandwidth usage.
>
> To do that easily, perhaps we need a function that plugs into
> wp_print_scripts() or similar and would switch to using Google Ajax API only
> on the front end, and could be included/referenced in other plugins (needs a
> hook). Perhaps that could make it in core too.
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>
More information about the wp-hackers
mailing list