[wordpress插件] Cached l10n快取10n

wordpress 插件 文章 2020-03-15 12:40 503 0 全屏看文

AI助手支持GPT4.0

评分
100
描述

Upon inspection using xhProf, I realized that the PHP implementation loading the MO files is really slow.

在使用xhProf进行检查时,我意识到PHP实现加载MO文件的速度确实很慢。

From my tests, about 25% to 40% of the time WordPress spends rendering the page is actually spent locating, parsing and merging all the translation files.

根据我的测试,WordPress花在渲染页面上的时间中大约有25%到40%的时间实际上是在查找,解析和合并所有翻译文件上。

This plugin works by caching the whole $l10n variable holding all the text domains and overridding the load_textdomain.

此插件通过缓存包含所有文本域的整个$ l10n变量并覆盖 load_textdomain

Caching is done using serialize and written to wp-content/uploads/l10n.pson.

使用序列化完成缓存,并将其写入 wp-content / uploads / l10n.pson

Be sure to regenerate the cache if a .mo changes.

如果.mo更改,请确保重新生成缓存。

TODO

待办事项

    • Provide a better UI page
    • 提供更好的UI页面

    Speed comparison

    速度比较

    Comparing WordPress Gettext loading vs this plugin.

    将WordPress Gettext加载与该插件进行比较。

    Using the average response time of:
        

    使用以下平均响应时间:
        

    siege -c 1 -r 100 -b http://localhost/

    围攻-c 1 -r 100 -b http:// localhost /

    Vanilla: Fresh install of WordPress

    Vanilla:全新安装WordPress

    Common: WPML, Types, Views, and Gravity Forms

    常见:WPML,类型,视图和重力形式

    Total Cache: Common + Total Cache (APC object/database cache, no page cache)

    总缓存:通用+总缓存(APC对象/数据库缓存,无页面缓存)

    BuddyPress: BP-Registration-Options, BP Show Friends, BuddyPress, BuddyPress Activity Plus, Gravity Forms, Invite Anyone, U BuddyPress Forum Attachment, U BuddyPress Forum Editor, User Switching

    BuddyPress:BP注册选项,BP显示好友,BuddyPress,BuddyPress活动增强版,重力窗体,邀请任何人,U BuddyPress论坛附件,U BuddyPress论坛编辑器,用户切换

                Vanilla         Common          Total Cache     BuddyPress

      Vanilla Common Total Cache BuddyPress

    Native 202 ms 565 ms 478 ms 567 ms

    原生202 ms 565 ms 478 ms 567 ms

    Cached 193 ms (-5%) 322 ms (-43%) 333 ms (-30%) 431 ms (-24%)

    缓存的193 ms(-5%)322 ms(-43%)333 ms(-30%)431 ms(-24%)

安装步骤

wp-content/uploads/l10n.pson must be writable

wp-content / uploads / l10n.pson必须可写

    1. Activate plugin
    2. 激活插件

    3. Go to plugin’s settings page
    4. 转到插件的设置页面

    5. Hit the regenerate button
    6. 点击“重新生成”按钮

    7. WP_DEBUG must be false
    8. WP_DEBUG 必须为假

下载地址
https://downloads.wordpress.org/plugin/cached-l10n.0.2.2.zip
-EOF-

AI助手支持GPT4.0