Linux 软件免费装
Banner图

Bloatwright – Performance Profiler & Site Speed Audit

开发者 emtiazzahid
更新时间 2026年11月7日 18:35
PHP版本: 7.4 及以上
WordPress版本: 7.1
版权: GPLv2 or later
版权网址: 版权信息

标签

debug performance page speed profiler plugin performance

下载

1.0.0

详情介绍:

Bloatwright answers one question: which plugins make this site slow, and by how much? It measures each one on real pages of your own site. Click Run profile. The plugin requests a handful of typical pages (home, the latest post, a page, the WooCommerce shop and a product when WooCommerce is active, the dashboard and the posts list) from your own server, several times each, with a profiler attached to those requests only. Visitors are never affected, nothing is deactivated, and no measurement data leaves your site (see External services below for the one optional, off-by-default kind of outbound request). For every plugin, theme and must-use plugin you get: Everything rolls up into a relative weight score (PHP time 40 %, query time 20 %, render-blocking KB 20 %, autoload KB 10 %, cron runs/day 10 %; render-blocking KB counts only the scripts and styles that block rendering on front-end pages) and, where a rule applies, a plain-language verdict, such as “Adds about 180 ms of PHP on every front-end page, including pages that may not use it” or “Expensive only on checkout (240 ms); cheap elsewhere.” Try without Pick a plugin and re-run the same URLs with that plugin filtered out of the profiling requests only. You see the before/after of every page, compared with the session you started it from, without deactivating anything for visitors. Browse-and-profile If your host blocks loopback requests, start a recording instead (it lasts two minutes by default; change it under Settings): the pages you open in your own browser are measured, front-end and admin alike. The recording cookie is host-only, so on a site whose front end and admin use different hosts, only pages on the host of the Site Address (Settings → General) are recorded. REST API, admin-ajax, cron, XML-RPC, login and media-upload requests and the Bloatwright screen itself are not measured, and each URL is recorded once. When the time is up the cookie expires and the recording ends; what it recorded is saved as a session the next time Bloatwright checks (the Bloatwright screen, or your next page view with the toolbar). A recording and an automatic run (including "Try without" and WP-CLI runs) never overlap: neither can start while the other is in progress. History, compare and export The newest twenty sessions are kept by default (Settings → "Sessions to keep"); older ones are deleted when a new run or recording starts. On the results screen a session can be compared with the previous regular session to see what changed after an update or a plugin swap; to compare any two sessions use wp bloatwright profile compare <a> <b> or the REST API (/wp-json/bloatwright/v1/sessions/<b>/compare/<a>). The History tab lists past sessions and, once there are two finished regular sessions, a PHP-time trend for the heaviest plugins; every session can be exported as a self-contained HTML report you can send to a client or a developer. Autoload and cron pages Two extra tabs break down the autoloaded options and the cron queue by owner, including cron hooks that have no callback attached (usually left behind by a removed plugin). WP-CLI --user is WP-CLI's global parameter: admin URLs are requested as that user and skipped (with a warning) when no user is given. Like the admin screen, profile run writes the must-use loader first when it is missing or out of date. How it works When a profiling run, a "Try without" run, a WP-CLI run or a browse-and-profile recording starts and the loader is missing or out of date, the plugin writes one small must-use plugin, 0-bloatwright-loader.php, into the must-use plugins folder (normally wp-content/mu-plugins). That file does nothing unless a request carries a signed, short-lived token; only then it starts the profiler, which sends no-cache headers, wraps hook callbacks with timers, records SAVEQUERIES output, reads the enqueued scripts and styles, and stores the result. You can remove the loader at any time from Settings → Advanced (it is written again on the next run), and it is removed when Bloatwright is deactivated. On multisite it is kept while Bloatwright is still active on another site of the network, and removed on network deactivation or when the last site deactivates it. Hooks for developers bloatwright_urls_default, bloatwright_owner_for_file, bloatwright_option_prefixes, bloatwright_verdicts, bloatwright_expected_slugs, bloatwright_session_complete, bloatwright_capability, bloatwright_loopback_sslverify, bloatwright_remote_head, bloatwright_remote_asset_owner, bloatwright_record_wait, and the action bloatwright_record, which runs at shutdown at the end of every profiled request (warm-up passes included, though they are not stored) with the request's measurement record and its context (session id, URL, pass, excluded plugin). More plugins by Emtiaz Zahid

安装:

  1. Upload the plugin to /wp-content/plugins/bloatwright or install it from the Plugins screen.
  2. Activate it, then go to Tools → Bloatwright and click Run profile.
  3. The first run writes 0-bloatwright-loader.php into the must-use plugins folder (normally wp-content/mu-plugins); if that folder is not writable, the Bloatwright screen (or the WP-CLI run) names the directory to make writable.

屏幕截图:

  • Expanded plugin row: PHP per URL, slowest hooks and queries, assets and options.
  • Try without: the same pages measured with one plugin filtered out.
  • Autoloaded options by owner.
  • A session compared with the previous one after an update.
  • Self-contained HTML export.

升级注意事项:

1.0.0 Initial release.

常见问题:

Does profiling affect my visitors?

No. Only requests carrying a valid signed token are profiled. Those requests are made by your own server (or by your own browser in browse-and-profile mode), and every profiled response is sent with no-cache headers and DONOTCACHEPAGE set, whether or not the request is logged in.

Why does it need a must-use plugin?

Normal plugins load in alphabetical order after all must-use plugins, so a profiler that is a normal plugin cannot time the plugins loaded before it. Must-use plugins load in file-name order, and the loader is named 0-bloatwright-loader.php, so it normally loads before your other must-use plugins. It checks for the token and otherwise returns immediately. A must-use plugin whose file name sorts even earlier loads before the profiler starts, so its load time is not measured (its hook callbacks still are). The loader is generated when your first run starts, can be removed from Settings → Advanced, and is deleted when Bloatwright is deactivated (on multisite: on network deactivation, or when the last site that has Bloatwright active deactivates it).

Can profiling change how a plugin behaves?

During a profiled request each timed hook callback (see the next question) is temporarily replaced by a timing wrapper stored under the same key and priority as the original. remove_action(), remove_filter(), has_action() and has_filter() called with the original callback still find it, so removals work as usual. Only code that reads the global $wp_filter directly sees a difference (a wrapper closure where the original callback was), and a backtrace taken inside a callback has one extra frame. The wrappers are taken off again when shutdown starts. This only affects the profiled requests themselves, never visitors.

Which hook callbacks are timed?

A hook's callbacks are wrapped the first time that hook fires after the profiler starts, and are timed from then on. Not timed:

  • callbacks added to a hook after it has already fired once during the request (for example a filter added to the_content while the page is being rendered);
  • callbacks on the special all hook;
  • callbacks on the translation filters gettext, gettext_with_context, ngettext and ngettext_with_context, which run thousands of times per page;
  • callbacks on shutdown, and anything they trigger: the wrappers are taken off when shutdown starts;
  • callbacks that take an argument by reference (for example function ( &$links ) on pre_ping), because a wrapper could only pass them a copy, and callbacks whose parameters cannot be inspected;
  • Bloatwright's own callbacks.
The time of a callback that is not timed is not charged to its owner. If it runs inside another callback that is timed (for example a translation filter running while a plugin calls __()), it counts toward that plugin's time.

The results say “served from a cache”

A page cache or CDN answered instead of WordPress. The profiler sends bypass headers and a cache-busting query string, but some setups still serve cached HTML. Use browse-and-profile while logged in, or exclude the profiling requests in your cache: they carry the User-Agent Bloatwright/<version>, the X-BLOATWRIGHT-Bypass header and the bloatwright_nocache query argument.

How accurate is the PHP time?

Each timed hook callback runs inside a small timing wrapper, and the time recorded for a callback includes that wrapper's own small cost, so plugins with many cheap callbacks read slightly high. The overhead is not subtracted. Bloatwright estimates it per request by timing its own bookkeeping and multiplying by the number of wrapped callback calls, and shows the estimate in the tooltip of each URL above the results table. Use several passes and compare min/avg/max; a plugin that is consistently heavy is the one to look at.

Why are the queries empty?

Bloatwright turns on SAVEQUERIES for the profiled requests only when wp-config.php does not define it. If wp-config.php defines SAVEQUERIES as false, no queries are recorded and the queries column stays empty; the results screen says so.

Can it profile the checkout, cart or logged-in pages?

Admin URLs are requested as the logged-in administrator whose admin screen runs the profile (or the WP-CLI --user): Bloatwright creates a separate login session for that user, sends its cookies with the admin requests only, and only to this site's own addresses (matching scheme, host and port; never over plain http when the admin uses https). The session is ended when the step or WP-CLI run finishes, or when the PHP request running it ends; at worst it expires after ten minutes. Your browser's cookies are never copied. From WP-CLI add --user=<id|login>; without it admin URLs are skipped. For pages that need a browser session (cart, checkout), use browse-and-profile.

Is anything sent to an external service?

Nothing is sent by default. The only outbound requests Bloatwright can make are the optional HEAD requests that read the size of remote scripts and styles (CDN copies, font stylesheets). They are off until you turn on "Measure remote asset sizes" under Tools → Bloatwright → Settings. Each goes to the asset's own URL with the User-Agent Mozilla/5.0 (compatible; Bloatwright/1.0.0), does not follow redirects, and its result is cached for a day.

Does the plugin send anything to its author?

No. Bloatwright has no server of its own and sends no usage statistics or telemetry. Profiling requests go to your own site's URLs. The only third-party requests are the optional HEAD requests to remote assets your pages already load, described under "External services"; that setting is off until you turn it on.

Where is the JavaScript source?

The admin app is built from assets/src/ with @wordpress/scripts; the shipped bundle is assets/build/admin.js. package.json and webpack.config.js are included in the plugin. To rebuild, run npm ci && npm run build in the plugin directory.

更新日志:

1.0.0