加速WordPress的加载


当我们使用除了english的其他语言时,Wordpress转换到这种语言时通常会降低加载的速度!我看了一下其他使用了本地化方案的wordpress果然有这样的现象(就是使用了mo文件的wordpress,加载普遍在1-2sec.而没用mo文件的可以在1sec.内),下面的这个hack就可以解决这个问题了!!
我们到Here下载这个压缩包-php-gettext-1.0.3.tar.gz,解压缩后,用gettext.php和streams.php覆盖在wp-includes文件夹中的原文件即可!
另外,用$input = new CachedFileReader($mofile)代替wp-l10n.php(在 function load_textdomain 函数中)中的$input = new FileReader($mofile),也可以节省几毫秒的时间!
原文地址:
http://www.m-e-x.de/blog/index.php/archives/2005/03/01/wordpress-15-speedup/
As anyone who uses foreign language support in WordPress 1.5 may have noticed, switching to language to something other than english slows down WordPress. On my server, no request was finished in under 2 seconds.

So I had a look at the “gettext.php” and optimized it a little bit (pushes request time down to 0.1 secs again), and Danilo Segan (the author and maintainer of php-gettext) made a new release with these changes:

https://savannah.nongnu.org/projects/php-gettext/

1. Download the package
2. Replace gettext.php and streams.php (in wp-includes)

Additionally you can replace
$input = new FileReader($mofile)
in function load_textdomain (wp-l10n.php) with
$input = new CachedFileReader($mofile)
which also saves a few microseconds.

落伍者中强人就是多!

落伍中随时都可能挖到一些好的东西,这不,翻了一下,找到一点好东西,做个笔记!!以后找到的好东西都放这里好了!! Read More »