Performance Chat Summary: 25 July 2023

Meeting agenda here and the full chat log is available beginning here on Slack.

Announcements

Priority Projects

Server Response Time

Link to roadmap projects

Contributors: @joemcgill @spacedmonkey @aristath @swissspidy

  • @swissspidy The post above is my update in this area ๐Ÿ™‚
  • @joemcgill One of the areas that I wanted to look into after theย 6.2 Performance Analysisย was how to improve the performance of template loading in both blockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. theme and classic theme contexts. I am planning an initial exploration into some architectural improvements that could be made to improve both.

Database Optimization

Link to roadmap projects

Contributors: @aristath @spacedmonkey @olliejones

  • No updates this week

JavaScriptJavaScript JavaScript or JS is an object-oriented computer programming language commonly used to create interactive effects within web browsers. WordPress makes extensive use of JS for a better user experience. While PHP is executed on the server, JS executes within a userโ€™s browser. https://www.javascript.com & CSSCSS Cascading Style Sheets.

Link to roadmap project

Contributors: @mukesh27 @10upsimon @adamsilverstein @westonruter

  • @10upsimon Not a massive update from my side, weโ€™re working on wrapping up some draft Developer Reference documentation updates that we hope to finalise this week

Images

Link to roadmap projects

Contributors: @flixos90 @thekt12 @adamsilverstein @joemcgill

  • @joemcgill Something Iโ€™ve been keeping an eye onโ€ฆthe HTMLHTML HyperText Markup Language. The semantic scripting language primarily used for outputting content in web browsers. spec was recently amended to include definition for letting browsers automatically calculate theย sizesย attribute for lazy-loaded images (see GH issue). Itโ€™s still in early implementation, but seems like this could be a useful thing for us to implement in WP since a lot of images are being lazy loaded by default, and our defaultย sizesย attribute is usually not all that accurate unless being filtered by theme authors.
    • Thinking this would be a great Perf Lab module candidate
    • GH issue to be created in the performance repo

Measurement

Link to roadmap projects

Contributors: @adamsilverstein @olliejones @joemcgill @mukesh27 @swissspidy

  • @swissspidy I assume there are some plans to measure performance of RC2 vs. 6.2 once itโ€™s out.
    For that I began putting together a tool to automate this sort of benchmark:ย https://github.com/swissspidy/compare-wp-performance
    Initially just a GitHubGitHub GitHub is a website that offers online implementation of git repositories that can easily be shared, copied and modified by other developers. Public repositories are free to host, private repositories require a paid subscription. GitHub introduced the concept of the โ€˜pull requestโ€™ where code changes done in branches by contributors can be reviewed and discussed before being merged by the repository owner. https://github.com/ Action, but now with the intention to have a script for running locally as well
    • @joemcgill This is such a nice workflow for automating this process

Ecosystem Tools

Link to roadmap projects

Contributors: @mukesh27 @swissspidy @westonruter

  • @mukesh27 Great news everyone! We have successfully completed the QA testing phase this week, and Iโ€™m happy to report that everything is working as expected. During the testing process, we identified a few issues which have been promptly raised on GH.
    • Moreover, Iโ€™m excited to announce that the technical documentation for our PluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party. Checker tool is now complete and merged. With the documentation in place, you can now gain a deeper understanding of the toolโ€™s functionality and how it works. For detailed context and information, please refer to the following link:ย https://github.com/10up/plugin-check/tree/trunk/docs
    • To stay up-to-date with our progress, follow us on GitHub:ย https://github.com/10up/plugin-check/ย We highly value your input! If you have any thoughts, ideas, or feedback, please donโ€™t hesitate to share them on the repository. Your contributions are immensely valuable to us.
  • @westonruter Last week I worked on extending the benchmark-web-vitals script to support running on a mobile device (e.g. connected via USB debugging). I got stuck however, and trying to figure out some missing piece:ย https://github.com/GoogleChromeLabs/wpp-research/pull/58
    • @swissspidy Testing on an actual mobile device sounds cool! Maybe someone from the Puppeteer team could help with this blockerblocker A bug which is so severe that it blocks a release.?
    • @westonruter Yeah, I tried an initial reachout on Friday, but I was out yesterday. Iโ€™ll see if I got anything once I catch up
    • @swissspidy Without a device at hand, is it alternatively possible to test with throttling?
    • @westonruter I asked Felix about that too, wondering if it was a capabilitycapability Aย capabilityย is permission to perform one or more types of task. Checking if a user has a capability is performed by the current_user_can function. Each user of a WordPress site might have some permissions but not others, depending on theirย role. For example, users who have the Author role usually have permission to edit their own posts (the โ€œedit_postsโ€ capability), but not permission to edit other usersโ€™ posts (the โ€œedit_others_postsโ€ capability).. It isnโ€™t right now, so weโ€™d have to figure out how to implement. It used to be a feature in DevTools but it seems to have been removed
    • @swissspidy CPU throttling can be found here, In Puppeteer:ย https://pptr.dev/api/puppeteer.page.emulatecputhrottling

Creating Standalone Plugins

Link to GitHub overview issue

Contributors: @flixos90 @mukesh27 @10upsimon

  • @10upsimon Iโ€™ve been working on some UIUI User interface mocks for the standalone plugin installation via the existing PL settings screen, and weโ€™ve arrived a pretty solid point to start execution. Currently doing some engineering discovery around what we can use from coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. and other resources to facilitate the plugin management using the same process as core that we see via the Plugins > Add screenย  (for installation, activation and deactivation of standalone performance plugins)

Open Floor

Our next chat will be held on Tuesday, August 1, 2023 at 15:00 UTC in the #core-performance channel in Slack.

#core-performance, #performance, #performance-chat, #summary

A Week in Core โ€“ July 24, 2023

Welcome back to a new issue ofย Week inย CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress.. Letโ€™s take a look at what changed onย TracTrac An open source project by Edgewall Software that serves as a bug tracker and project management tool for WordPress.ย between July 17 and July 24, 2023.

  • 44 commits
  • 83 contributors
  • 83 tickets created
  • 13 tickets reopened
  • 56 tickets closed

Ticketticket Created for both bug reports and feature development on the bug tracker.ย numbers are based on theย Trac timeline for the period above. The following is a summary of commits, organized by component and/or focus.

Code changes

Administration

  • Add a missing closing span tagtag A directory in Subversion. WordPress uses tags to store a single snapshot of a version (3.6, 3.6.1, etc.), the common convention of tags in version control systems. (Not to be confused with post tags.) for column sorting indicators โ€“ #32170, #57839
  • Update dashboard welcome panel for 6.3 โ€“ #58545

Build/Test Tools

  • Remove outmoded jsvalidate task from Gruntfile โ€“ #58645, #26615

Bundled Themes

  • Twenty Twenty-One: Enable Dark Mode in the blockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. editor iframeiframe iFrame is an acronym for an inline frame. An iFrame is used inside a webpage to load another HTML document and render it. This HTML document may also contain JavaScript and/or CSS which is loaded at the time when iframe tag is parsed by the userโ€™s browser. โ€“ #58835
  • Twenty Twenty-Three: Remove the perPage attribute where the query inherits from the global query. The global attribute should be used instead โ€“ #58581
  • Twenty Twenty-Three: Revert [55898] โ€“ #58485

Code Modernization

  • Use str_contains() in a few more places โ€“ #58206

Coding Standards

  • Always use parentheses for class instantiation โ€“ #58831
  • Correct alignment in wp-includes/media.php โ€“ #58831
  • Correct equals sign alignment in various files โ€“ #58831
  • Remove trailing tabs in wp-admin/about.php โ€“ #58831, #58067
  • Use strict comparison for static strings in wp-admin/includes/class-wp-list-table.php โ€“ #32170, #57839

Docs

  • Add a missing word in maybe_create_table() description โ€“ #58841
  • Fix indentation issue in WP_REST_Global_Styles_Revisions_Controller class โ€“ #57840, #58524
  • Fix various incorrect @since mentions โ€“ #58834
  • Various docblocks corrections โ€“ #57840

Editor

  • Add test for context setting in Comment Template block โ€“ #58839
  • Fix a PHPPHP The web scripting language in which WordPress is primarily architected. WordPress requires PHP 7.4 or higher notice appearing when adding a new template part โ€“ #57851
  • Fix abbreviations of โ€œExampleโ€ in block-template-utils.php โ€“ #58879
  • Fix bugbug A bug is an error or unexpected result. Performance improvements, code optimization, and are considered enhancements, not defects. After feature freeze, only bugs are dealt with, with regressions (adverse changes from the previous version) being the highest priority. where it was not possible to style custom block elements in theme.json โ€“ #57868
  • fix popover positioning โ€“ #58847
  • load title on navigation fallback โ€“ #58557
  • update npm packages with bug fixes for 6.3 RC2 โ€“ #58804

External Libraries

  • Update deprecated jQuery code in Farbtastic lib โ€“ #57946

General

  • Commit changes after running precommit:css โ€“ #57856, #58869
  • Rename wp_in_development_mode() to wp_is_development_mode() โ€“ #57487

HTMLHTML HyperText Markup Language. The semantic scripting language primarily used for outputting content in web browsers. APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways.

  • Change wp infix in test classes to Wp โ€“ #58899
  • Introduce minimal HTML Processor โ€“ #58517

Help/About

  • Add illustrations to the Get Involved tab โ€“ #23348
  • String changes in the Contribute screen โ€“ #23348
  • Update the About page for 6.3 โ€“ #58067
  • Updates to About page โ€“ #58067

I18Ni18n Internationalization, or the act of writing and preparing code to be fully translatable into other languages. Also see localization. Often written with a lowercase i so it is not confused with a lowercase L or the numeral 1. Often an acquired skill.

  • Add missing translator comment in WP_Upgrader::generic_strings() โ€“ #58831

Media

  • Adjust PDF upload handling to remove non-opaque alpha channels from previews โ€“ #39216
  • Fix Image rotation button overflow in translations โ€“ #58877
  • Fix height max value in image scaling โ€“ #50523
  • Stop using and deprecate set_imagick_time_limit(). Seems it causes more problems than it solves โ€“ #58202

REST APIREST API The REST API is an acronym for the RESTful Application Program Interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data. It is how the front end of an application (think โ€œphone appโ€ or โ€œwebsiteโ€) can communicate with the data store (think โ€œdatabaseโ€ or โ€œfile systemโ€) https://developer.wordpress.org/rest-api/

  • Update Global styles revisionsRevisions The WordPress revisions system stores a record of each saved draft or published update. The revision system allows you to see what changes were made in each revision by dragging a slider (or using the Next/Previous buttons). The display indicates what has changed in each revision. private methods to protected โ€“ #58846

Script Loader

  • Improve test coverage for wp_print_scripts() โ€“ #58648

Upgrade/Install

  • Add correct parameters to add_option in upgrade_630 โ€“ #58821

Props

Thanks to the 83 (!) people who contributed to WordPress Core on Trac last week:

@costdev (11), @audrasjb (7), @joemcgill (7), @ramonopoly (6), @mukesh27 (6), @jrf (5), @peterwilsoncc (5), @azaozz (4), @flixos90 (4), @markoserb (4), @oglekler (4), @richtabor (4), @swissspidy (3), @spacedmonkey (3), @joedolson (3), @sergeybiryukov (3), @jorbin (2), @poena (2), @desrosj (2), @dmsnell (2), @dunhakdis (2), @huzaifaalmesbah (2), @westonruter (2), @peterwilson (1), @ryelle (1), @andrewserong (1), @gudmdharalds (1), @glendaviesnz (1), @oandregal (1), @TobiasBg (1), @Malae (1), @sabernhardt (1), @Presskopp (1), @mrinal013 (1), @Rahmohn (1), @mikachan (1), @robinwpdeveloper (1), @onemaggie (1), @dsar (1), @antpb (1), @hberberoglu (1), @mtxz (1), @densityapps (1), @ekazda (1), @matt_fw (1), @jameskoster (1), @soulseekah (1), @mikeschroder (1), @wildworks (1), @davidbaumwald (1), @annezazu (1), @saxonafletcher (1), @mwtsn (1), @hasanuzzamanshamim (1), @Ankit K Gupta (1), @get_dave (1), @scruffian (1), @nekojonez (1), @jordesign (1), @bhrugesh12 (1), @kebbet (1), @isabel_brison (1), @zieladam (1), @gitlost (1), @launchinteractive (1), @emirpprime (1), @ceer (1), @joen (1), @maysi (1), @madejackson (1), @6adminit (1), @crstauf (1), @james0r (1), @jpantani (1), @dansoschin (1), @mikinc860 (1), @priethor (1), @marybaum (1), @eidolonnight (1), @clarkeemily (1), @cbringmann (1), @meher (1), and @youknowriad (1).

Congrats and welcome to our 7 new contributors of the week:ย @mwtsn, @launchinteractive, @ceer, @maysi, @madejackson, @6adminit, @james0rย โ™ฅ๏ธ

Core committers: @audrasjb (10), @sergeybiryukov (9), @isabel_brison (4), @ryelle (4), @bernhard-reiter (3), @joedolson (2), @davidbaumwald (2), @azaozz (2), @joemcgill (2), @desrosj (1), @antpb (1), @mikeschroder (1), @spacedmonkey (1), @flixos90 (1), and @kadamwhite (1).

#6-3, #core, #week-in-core

Performance Chat Agenda: 25 July 2023

Here is the agenda for this weekโ€™s performance team meeting scheduled for July 25, 2023 at 15:00 UTC.


This meeting happens in the #core-performance channel. To join the meeting, youโ€™ll need an account on the Make WordPress Slack.

#agenda, #meeting, #performance, #performance-chat

Editor Chat Agenda: July 26th 2023

Facilitator and notetaker: @get_dave.

This is the agenda for the weeklyย editor chatย scheduled forย 2023-07-26 14:00 UTC.

This meeting is held in theย #core-editorย channel in the Making WordPressย SlackSlack Slack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/.

If you cannotย attendย the meeting, you are encouraged to share anything relevant to the discussion:

  • If you have an update for theย main site editing projects, please feel free to share as a comment or come prepared for the meeting itself.
  • If you have anything to share for theย Task Coordinationย section, please leave it as a comment on this post.
  • If you have anything toย propose for the agendaย or other specific items related to those listed above, please leave a comment below.

#agenda, #core-editor, #core-editor-agenda, #meeting

I18N Performance Analysis

A recent in-depth performance analysis of WordPress core showed that loading translations had a significant hit on a siteโ€™s server response time. Given that more than half of all WordPress sites use a language other than English (US), the performance team identified this as an area worth looking into more closely. The team spent the last couple of months exploring this in more detail and the results are now shared in this blogblog (versus network, site) post.

This is merely an analysis of the current i18ni18n Internationalization, or the act of writing and preparing code to be fully translatable into other languages. Also see localization. Often written with a lowercase i so it is not confused with a lowercase L or the numeral 1. Often an acquired skill. system in WordPress with some proposed under-the-hood performance improvements. No decisions have been made on any of these proposals.

Context

Initial benchmarks showed that the median loading time for a localized site can be up to 50% slower than for non-localized sites, depending on which themes and plugins are being used. This was measured using both the wpp-research CLI tool and also a dedicated benchmark environment (as elaborated in the Comparison section towards the end).

The WordPress i18n system is based on gettext, which uses source .po (Portable Object) files and binary .mo (Machine Object) files for storing and loading translations. It is not using the C gettext APIAPI An API or Application Programming Interface is a software intermediary that allows programs to interact with each other and share data in limited, clearly defined ways. itself but a custom userland implementation that works without any external dependencies.

In addition to coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. itself, each pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party. and theme has its own translationtranslation The process (or result) of changing text, words, and display formatting to support another language. Also see localization, internationalization. file, which has to be loaded and parsed on every request. Loading and parsing all these translation files is an expensive task.

In the past, various solutions have been discussed and explored to improve the i18n performance of WordPress. A non-exhaustive list:

  • Use a more lightweight MO parser
  • Improve translation lookups by using the hash map in MO files (e.g. with DynaMo)
  • Caching translations in the object cache
  • Caching translations in APCu (an in-memory key-value store for PHPPHP The web scripting language in which WordPress is primarily architected. WordPress requires PHP 7.4 or higher)
  • Other more elaborated forms of caching (e.g. per request)
  • Using the native PHP gettext extension
  • Use a custom PHP extension to handle the MO file parsing)
  • Using lazily evaluated translation calls (see #41305 for details)
  • Using a different file format than .mo files, e.g. plain .php files

A more recent discussion touching on all of these solutions can be found over at the wordpress/performance repository. Itโ€™s a great way to get some context on this topic.

For this analysis, many of these solutions were looked at, focusing on their advantages and disadvantages. At the end of this post there is a comparison table with some much needed numbers as well, based on custom-built benchmarks.

Solutions

Solution A: Use different file format

Use a different file format for translations instead of .mo files to avoid the overhead of loading and parsing binary files.

Design considerations

With this solution, translations will be stored in plain .php files returning an associative array of translation strings. Whenever a .php file is available, it will be preferred over the .mo file, which is still used as a fallback. The rest of the architecture remains the same.

When a localized WordPress site downloads language packs from the translate.wordpress.org translation platform, it downloads .po and .mo files containing all the translations. This will be modified to include .php files. GlotPress, which the platform is built on, will be updated to support this new output format. Additionally, WordPress core itself could be modified to generate PHP files whenever they are missing.

In theory, nothing is faster in PHP than loading and executing another PHP file. .json, .ini, or .xml would all be much slower.

Proof of concepts using the PHP files can be found at swissspidy/wp-php-translation-files and swissspidy/ginger-mo.

Benefits

  • Initial benchmarks show consistent significant performance improvements
  • Relatively trivial to implement
  • Maintains backward compatibility thanks to graceful fallback
  • Makes it easier for users to inspect and change translations (no need to compile .po to .mo)
  • Avoids loading and parsing binary .mo files, which is the main bottleneck
  • Lets PHP store translations in OPcache for an additional performance benefit
  • Battle-tested approach in the PHP ecosystem (for example in Laravel)

Caveats and risks

  • Requires not only changes to WordPress core, but also tools like GlotPress and WP-CLIWP-CLI WP-CLI is the Command Line Interface for WordPress, used to do administrative and development tasks in a programmatic way. The project page is http://wp-cli.org/ https://make.wordpress.org/cli/
  • Adds maintenance overhead by introducing a new file format on top of the existing one
    • As shown by the proof of concept, the overhead is minimal
    • In the long term, .mo support could be deprecated
  • Security considerations due to essentially executing remotely fetched PHP files
    • Not really different from downloading plugins/themes from WordPress.org
    • WordPress considers translations to be trusted
    • Hosting providers could be blocking PHP execution in wp-content/languages
    • Could potentially use checksum verifications or static analysis at install time to detect anomalies

Effort and timeline

The proof of concept using PHP files is in a very solid state already. There are also examples for changes to WP-CLI (PR) and GlotPress (PR). This makes it suitable for a feature project to expand testing with very little effort required. Even a core merge would be very straightforward in a relatively short time, potentially already in Q4 2023. The security aspect when using PHP files could be a potential blockerblocker A bug which is so severe that it blocks a release., so itโ€™s important to loopLoop The Loop is PHP code used by WordPress to display posts. Using The Loop, WordPress processes each post to be displayed on the current page, and formats it according to how it matches specified criteria within The Loop tags. Any HTML or PHP code in the Loop will be processed on each post. https://codex.wordpress.org/The_Loop in the WordPress security team and hosting providers early on.

More time is required to test other file formats and compare results.

Solution B: Native gettext extension

Use the native gettext PHP extension written in C when available, instead of the custom built-in parser in WordPress.

Design considerations

WordPress has always used a custom MO file parser, because the native gettext extension is not necessarily available on the server. With this solution, the existing system is adapted to use the extension whenever available and falling back to the custom implementation if not.

This has been previously explored in #17268 and implemented in WP Performance Pack and Native Gettext. These implementations can serve as inspiration for the initial design. They all work similarly in that they symlink or copy the translation files to a new directory structure that is compatible with the gettext extension.

As of July 2023, around 66% of all localized WordPress sites have the gettext extension installed, according to information from the WordPress update requests.

Benefits

  • Significant performance improvements for eligible sites
    • Initial benchmarks show that loading time and memory usage basically do not differ from non-localized sites

Caveats and risks

  • The gettext extension is not commonly available
    • Smaller incentive to implement and lower impact overall
  • Requires locales to be installed on the server
    • Servers rarely have many installed locales
      • Locales often need to be compiled first and take up a lot of space
      • WordPress on the other hand supports over 200 locales
    • Potential clashes with the custom locales WordPress supports
      • For example, locales like pt_PT_ao90, de_DE_formal or roh might not even be supported
    • Outreach to hosting providers would be necessary
  • Adds maintenance overhead by essentially adding a second gettext implementation
  • Poor API
    • Requires setting environment variables (such as LC_MESSAGES and LANGUAGE), which might not be possible or cause conflicts on certain servers/sites
  • Requires symlinks or hard file copies
    • Symlinks might not be possible on the server; copying all translation files means doubling disk usage
  • Translation files are cached by PHP, thus any translation change requires restarting the web server
    • There are workarounds such as cache busting using random file names or fstat, however they might not work on all environments
  • Has not been tested on a wider scale, despite being discussed for years

Check out the code of WP Performance Pack and Native Gettext to get a better idea of the extensionโ€™s poor API.

Effort and timeline

While there are existing implementations that could be leveraged for this solution, further field testing is required to assess whether the extension actually works under all circumstances. Given the limitations around the poor API and requirements for installing locales, it does not seem like a viable solution at all.

Solution C: Cache translations

Cache translations somehow to avoid expensive .mo parsing.

Design considerations

Cache translations either on disk, in the database, or the object cache to avoid expensive .mo file parsing on subsequent requests. This can be done in a generalized manner or also on a per-request basis to only load translations required for the current URLURL A specific web address of a website or web page on the Internet, such as a websiteโ€™s URL www.wordpress.org.

Many different caching strategies have been explored in various forms in the past, each with their own pros and cons. Some could even be combined. Defining the exact implementation requires further exploration and testing, which warrants its own exploration post.

Benefits

  • Caching translations after one time .mo parsing potentially improves performance for future requests

Caveats and risks

  • Caching using persistent object cache (e.g. Memcached, Redis) or APCu:
    • Not available on most sites, making this not an ideal solution
      • Availability according to data from WordPress update requests:
        • Memcached: ~25%
        • Redis: ~25%
        • APCu: ~6%
    • Can potentially significantly increase cache size or exceed cache key limits
  • Database caching:
    • Moves the problem from disk reads to database reads
    • Can potentially significantly increase database size
    • Alternatively, use sqlite as a cache backend
      • Untested approach
      • Available on around 90% of sites
  • Disk caching:
    • Not always possible, depending on server environment
    • Still causes file reads, only with fewer or other files
  • Multiple cache groups (e.g. per-request or frontend/adminadmin (and super admin) split)
    • Smarter cache logic to only load translations that are needed for the majority of requests
    • Can potentially significantly increase cache size
    • Unlikely that different requests use very different translations
  • Cache retrieval adds overhead
    • Exact performance gains depend on implementation method and need to be measured first
    • No performance gains with cold cache
    • Cache invalidation logic TBD

Effort and timeline

Given the existing solutions in the ecosystem, the engineering effort itself would not be too big, but the right caching implementation (e.g. disk cache or object cache) needs to be evaluated first.

However, the right caching strategy probably does not exist because of all the different hosting environments. Since itโ€™s unrealistic for core to support multiple types of caching, this solution seems better suited for plugins rather than core.

Solution D: Lazily evaluated translation calls

Use lazily evaluated translation calls to reduce the number of function calls in certain cases, leading to improved performance.

Design considerations

The idea of lazily evaluated translation calls has been first discussed in #41305. It enables avoiding string-specific expensive translation lookups until the translations are actually needed, by passing around proxy objects.

In other words: beyond just-in-time loading of translation files (which WordPress already does), this would add just-in-time lookup of individual strings in the translations. Check out this proof of concept to get a better picture.

It can be integrated essentially in two ways, both of which are explained on the core ticketticket Created for both bug reports and feature development on the bug tracker.:

  1. Change all translation calls to be lazily evaluated by default
  2. Make this opt-in, either with new function arguments or new functions altogether

Benefits

  • Reduces the number of translation lookups, in some scenarios drastically
    • On a regular home page request there are ~60% less translation calls, saving around ~10ms (as measured by XHProf)
  • As a side effect, solves UXUX User experience issues such as #38643

Caveats and risks

  • Depending on implementation this either breaks backward compatibility or risks not gaining enough adoption
    • Documentation, tooling, and developer education can help mitigate this to a certain extent
    • Adoption could be done gradually, e.g. starting with an opt-in approach and eventually making it the default
  • Likely will not have a significant impact on typical frontend page loads, as itโ€™s mostly useful for areas like the REST APIREST API The REST API is an acronym for the RESTful Application Program Interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data. It is how the front end of an application (think โ€œphone appโ€ or โ€œwebsiteโ€) can communicate with the data store (think โ€œdatabaseโ€ or โ€œfile systemโ€) https://developer.wordpress.org/rest-api/ schema output, where a lot of translation calls are made without actually using the translations
    • Needs analysis in more scenarios to measure impact
    • The REST API schema already has a workaround by using a cache in a static variable
  • Does not improve situation for actually loading translation files
  • Initial testing shows that this actually hurts performance due to the additional thousands of proxy objects being created

Effort and timeline

Gradual adoption would mean a multi-year effort to establish lazily evaluated translation calls, while enabling this by default is a significant backward compatibility break that could affect thousands of plugins and themes in the ecosystem. And since it does actually slow down performance in some cases, this solution is not a great candidate for implementation.

Solution E: Optimize/Rewrite existing MO parser

Refactor the existing MO parser in WordPress to be more performant.

Design considerations

Completely overhaul the existing MO translation file parser in WordPress with performance in mind. For example by using Ginger MO, WP Performance Pack, or other existing solutions as a base.

While for instance Altis DXP (Human Made) have actually replaced the existing MO parser with a custom-made PHP extension written in Rust, such an approach is obviously not feasible for core. The new solution needs to be written in userland PHP.

Initial testings with an updated fork of Ginger MO show some noticeable speedups and lower memory usage. It also supports multiple translation files per text domain and multiple locales loaded at once, which could prove beneficial for improving the localeLocale A locale is a combination of language and regional dialect. Usually locales correspond to countries, as is the case with Portuguese (Portugal) and Portuguese (Brazil). Other examples of locales include Canadian English and U.S. English. switching functionality in WordPress core.

Besides that, plugins like WP Performance Pack and DynaMo have implemented partial lookups using the MO hash table or binary search, avoiding reading the whole file and storing it in memory. That slightly reduces memory usage and performance.

Benefits

  • Can be used without necessarily introducing another file format
  • Opens up potential performance enhancements in other areas, i.e. locale switching
  • Mostly maintains backward compatibility

Caveats and risks

  • Still a risk of breaking backward compatibility

Effort and timeline

There already is a working proof of concept for this solution, but more testing is required to further refine it and improve its backward compatibility layer. With such an effort being an ideal candidate for a feature pluginFeature Plugin A plugin that was created with the intention of eventually being proposed for inclusion in WordPress Core. See Features as Plugins, this could be achieved relatively quickly in a few months.

Solution F: Splitting up translation files

Split translation files from plugins and themes into smaller chunks to make loading them more efficient.

Design considerations

Depending on the projectโ€™s size, translation files can be quite big. Thatโ€™s why WordPress itself uses separate translation files for the admin and everything else, so that not too many strings are unnecessarily loaded.

This strategy could be applied to plugins and themes as well. Either by allowing them to use multiple text domains (which would require developer education and changes to tooling), or by somehow doing this automatically (exact method TBD)

Benefits

  • Faster loading times due to loading smaller files

Caveats and risks

  • Risk of breaking backward compatibility
  • Opt-in approach requires tooling and distribution changes and risks slow adoption

Effort and timeline

Further research is required to evaluate this properly.

Comparison

At first glance, solution A (PHP translation files) is a relatively straightforward enhancementenhancement Enhancements are simple improvements to WordPress, such as the addition of a hook, a new feature, or an improvement to an existing feature. that maintains backward compatibility and shows promising improvements. However, it does not only require changes to core itself, but also to the translation platform. The security aspect remains a risk, although discussing it early on with stakeholders and gathering more testers would help mitigate it.

Leveraging the native gettext extension as in solution B shows stunning results, but the lack of availability and the non-ideal API are a concern. Still, itโ€™s a progressive enhancement that cannot be ignored. Especially since it could pretty much eliminate the need for additional caching as in solution C.

Caching already loaded translations as in solution C does not eliminate the root cause of the i18n slowness, but can speed up subsequent requests. Unfortunately, persistent object caches or APCu are rather uncommon (though we do not have exact data on the former yet, see #58808), and implementing more complex types of caching (e.g. per-request caching) would require significant exploration effort before becoming a viable option.

Lazily evaluated translation calls (solution D) can shave time off translation calls in some situations, but overall actually decrease performance. While it could help solve some actual UX issues in core, the backward compatibility and adoption concerns make it even less of a suitable solution.

Existing plugins like Ginger MO and WP Performance Pack show that the existing MO parser in WordPress can be further improved (solution E).

Benchmarks

Now to the most interesting part: the hard numbers!

These benchmarks are powered by a custom-built performance testing environment using @wordpress/env and Playwright. The environment has been configured with some additional plugins and the PHP extensions required for some of the solutions. Tests have been performed against the 6.3 RCrelease candidate One of the final stages in the version release cycle, this version signals the potential to be a final release to the public. Also see alpha (beta). by visiting the home page and the dashboard 30 times each and then using the median values.

You can find the exact setup in this wp-i18n-benchmarks GitHub repository.

BlockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. Theme

LocaleScenarioObject CacheMemory UsageTotal Load Time
en_USDefault15.60 MB133.58 ms
de_DEDefault29.14 MB181.95 ms
de_DEGinger MO (MO)19.24 MB159.18 ms
de_DEGinger MO (PHP)16.98 MB138.14 ms
de_DEGinger MO (JSONJSON JSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML.)19.24 MB153.39 ms
de_DENative Gettext15.99 MB142.12 ms
de_DEDynaMo19.62 MB157.93 ms
de_DECache in APCu50.37 MB181.51 ms
en_USDefaultโœ…15.67 MB121.53 ms
de_DEDefaultโœ…29.01 MB167.67 ms
de_DEGinger MO (MO)โœ…19.11 MB147.19 ms
de_DEGinger MO (PHP)โœ…16.85 MB127.97 ms
de_DEGinger MO (JSON)โœ…19.11 MB144.43 ms
de_DENative Gettextโœ…15.86 MB129.19 ms
de_DEDynaMoโœ…18.57 MB133.46 ms
de_DECache in APCuโœ…50.30 MB170.19 ms
de_DECache in object cacheโœ…29.07 MB173.19 ms
Benchmarks using the Twenty Twenty-Three block theme

Classic Theme

LocaleScenarioObject CacheMemory UsageTotal Load Time
en_USDefault15.35 MB120.79 ms
de_DEDefault28.79 MB172.10 ms
de_DEGinger MO (MO)18.85 MB145.68 ms
de_DEGinger MO (PHP)16.56 MB124.73 ms
de_DEGinger MO (JSON)18.84 MB140.78 ms
de_DENative Gettext15.58 MB128.26 ms
de_DEDynaMo19.24 MB146.09 ms
de_DECache in APCu50.13 MB167.28 ms
en_USDefaultโœ…15.19 MB107.26 ms
de_DEDefaultโœ…28.59 MB154.30 ms
de_DEGinger MO (MO)โœ…18.64 MB133.21 ms
de_DEGinger MO (PHP)โœ…16.37 MB112.94 ms
de_DEGinger MO (JSON)โœ…18.64 MB128.94 ms
de_DENative Gettextโœ…15.38 MB115.11 ms
de_DEDynaMoโœ…18.10 MB120.72 ms
de_DECache in APCuโœ…49.99 MB151.82 ms
de_DECache in object cacheโœ…28.65 MB156.36 ms
Benchmarks using the Twenty Twenty-One classic theme

Admin

LocaleScenarioObject CacheMemory UsageTotal Load Time
en_USDefault15.42 MB139.83 ms
de_DEDefault31.92 MB187.76 ms
de_DEGinger MO (MO)20.07 MB164.94 ms
de_DEGinger MO (PHP)17.09 MB139.66 ms
de_DEGinger MO (JSON)20.06 MB160.87 ms
de_DENative Gettext15.95 MB143.43 ms
de_DEDynaMo20.58 MB166.79 ms
de_DECache in APCu58.13 MB190.38 ms
en_USDefaultโœ…15.66 MB112.69 ms
de_DEDefaultโœ…31.84 MB164.26 ms
de_DEGinger MO (MO)โœ…19.99 MB140.70 ms
de_DEGinger MO (PHP)โœ…17.01 MB118.52 ms
de_DEGinger MO (JSON)โœ…19.98 MB138.49 ms
de_DENative Gettextโœ…15.87 MB120.01 ms
de_DEDynaMoโœ…19.73 MB120.26 ms
de_DECache in APCuโœ…58.07 MB162.41 ms
de_DECache in object cacheโœ…31.86 MB164.28 ms
Benchmarks visiting the WordPress admin

Conclusion

Finding the right path forward means weighing all the pros and cons of each solution and looking at both horizontal and vertical impact, i.e. how much faster can i18n be made for how many sites.

When looking at all these factors, it appears that a revamped translations parser (solution E) could bring the most significant improvements to all localized WordPress sites. Especially when combined with a new PHP translation file format (solution A), which Ginger MO supports, the i18n overhead becomes negligible. Of course the same risks associated with introducing a new format apply.

On top of that, a revamped i18n library like Ginger MO could also be combined with other solutions such as caching or dynamic MO loading to potentially gain further improvements. However, those routes have yet to be explored.

Next steps

The WordPress performance team wants to further dive into this topic and test some of the above solutions (and combinations thereof) on a wider scale through efforts like the Performance Lab feature project. We are looking forward to hearing your feedback on this analysis and welcome any additional comments, insights, and tinkering.

Deadline August 6, 2023

After the deadline passes, the performance team will discuss the received feedback and determine next steps.


Thank you to @flixos90, @westonruter, @joemcgill, @spacedmonkey, and @adamsilverstein for reviewing and helping with this post. Thank you to @nbachiyski, @ocean90, @akirk, @rmccue, @dd32 for providing valuable insights and context.

#core, #i18n, #performance

Editor chat summary: Wednesday, July 19, 2023

This post summarizes the weeklyย editor chatย meeting onย Wednesday, 19 July 2023, 14:00 UTC, held inย Slack.

Announcements

WordPress 6.3 RC1 was released on July 18. @jorgefilipecosta congratulated everyone that participated in the release.

Key project updates

There were no updates for the key projects shared during the meeting.

Task coordination

@jorgefilipecosta

Open floor

There were no topics of discussion raised on the open floor,

#core-editor, #core-editor-summary, #gutenberg, #meeting, #meeting-notes, #summary

X-post: Online monthly Docs Team Contributor Day July 25, 2023

X-comment from +make.wordpress.org/docs: Comment on Online monthly Docs Team Contributor Day July 25, 2023

6.3 Live Product Demo Q&A

Honoring a WordPress tradition, this post will recap the question-and-answer segment of the 6.3 Live Product Demo.

6.3 release squad members, Anne McCarthy and Rich Tabor, prepared a live product demonstration, moderated by Nathan Wrigley, to highlight aspects of this monumental release.ย You can read some of the highlights or watch the recording below.

6.3 Live Product Demo

The panelists answered a number of questions for attendees.

Q1: It felt like Phase 2 went on longer than expected, producing ongoing quality-of-life improvements to the Site Editor. Itโ€™s been, in a word, wonderful. While Iโ€™m excited for Phase 3 and what lies ahead, is it possible Phase 2 aspects will continue to be revisited and refined concurrently with Phase 3, or is this expect to be a more thorough wind-down โ€” meaning the Site Editor in 6.3 is roughly where it is expected to be going forward?

A1: Thereโ€™s more to come, and the work isnโ€™t over. Check out this overview GitHub issue here for whatโ€™s already planned for iteration.

Q2: Can you assign Patterns to Categories?

A2: Not yet. More info here for anyone interested in the details within this GitHub issue.

Q3: But there are no revisionsRevisions The WordPress revisions system stores a record of each saved draft or published update. The revision system allows you to see what changes were made in each revision by dragging a slider (or using the Next/Previous buttons). The display indicates what has changed in each revision. at the style book, or did I miss this?

A3: The revisions show changes for all of styles, including changes made when viewing the style book.

Q4: Is this doc you created accessible? The one with the different uses for the Reusable Blocks, Patterns, etc?

A4: For more information, read the overview on comparing patterns template parts, and reusable blocks (now synced patterns.)

Q5: For classic themes, will it be possible to access the pattern editor? Either directly or indirectly?

A5: Classic themes can create patterns, and the reusable blockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. management screen is reused to store them. More info on the Patterns section, specifically in the Site Editor being exposed for Classic Themes here in this GitHub issue. Great spot to share feedback!

Q6: There are no revisions in the style book, or did I miss this?

A6: The revisions show changes for all of styles, including changes made when viewing the style book.

Q7: Are footnotes finalized, and will they be released in WP 6.3?

A7: Yes, they will.

Q8: Do we have any rough ideas of previewing a theme, working on it, saving that, but NOT activating or scheduling when it goes live

A8: Some rough ideas here from prior design efforts.

Q9: From my testing, I found that you donโ€™t need to highlight anything to add a footnote number, just place the cursor behind the word where the footnote numbrt should goโ€ฆ Is that a hidden feature or a bugbug A bug is an error or unexpected result. Performance improvements, code optimization, and are considered enhancements, not defects. After feature freeze, only bugs are dealt with, with regressions (adverse changes from the previous version) being the highest priority.?

A9: Itโ€™s a feature! Though I find selecting more intuitive.

Q10: Is there any option to apply global styles (theme.jsonJSON JSON, or JavaScript Object Notation, is a minimal, readable format for structuring data. It is used primarily to transmit data between a server and web application, as an alternative to XML. variations) to different templates separately? btw new aspect ratio input is cool!

A10: Not yet, but on the radar. Iโ€™d love to be able to apply variations to templates, even patterns. Calling them Theme.json Partials (partially applied theme.json).ย 

Q11: With 6.3, CSSCSS Cascading Style Sheets. Grids come to query builder. But what is the plan for CSS grids in the group block (Row, Stack, and Grid)? And will it be a full implementation or a limited one (as the current limited Flexbox implementation in Row features)?

A11: Here is some additional info on layout updates in the editor.

Q12: Is there any information about the possibility of applying multiple block styles to blocks? Also info about block styles to be applied just to block variation, not the coreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. block? Struggling with creating styles and variations.

A12: Not multiple block styles, but you can design a block variation within the Style Book.

Q13: Is there any news regarding native multilingual support in Core?

A13: Not quite as multilingual support is slated for Phase 4 on the WordPress roadmap.

Q14: Regarding the rollback of failed manual plugins and theme updates. This will happen even if the updates break and make the website fails with a fatal error like some kind of recovery mode.

A14: For more information on failed manual pluginPlugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party. and theme updates, check out this Core post.

Additional references mentioned during the live product demo

#6-3, #live-product-demo

WordPress 6.3 Accessibility Improvements

Thank you to @joedolson and @alexstine for collaborating to write this post.

With WordPress 6.3 set to launch on August 8th, 2023, this post seeks to provide an overview of the many accessibilityAccessibility Accessibility (commonly shortened to a11y) refers to the design of products, devices, services, or environments for people with disabilities. The concept of accessible design ensures both โ€œdirect accessโ€ (i.e. unassisted) and โ€œindirect accessโ€ meaning compatibility with a personโ€™s assistive technology (for example, computer screen readers). (https://en.wikipedia.org/wiki/Accessibility) improvements and fixes coming to the next major WordPress release. As always, thereโ€™s more work to be done with accessibility requiring an ongoing effort and commitment.ย 

If youโ€™re interested in helping with this work, please join the #accessibility channel in Make SlackSlack Slack is a Collaborative Group Chat Platform https://slack.com/. The WordPress community has its own Slack Channel at https://make.wordpress.org/chat/ and check out how you can get involved. There are numerous ways to get involved in this important work including testing, giving accessibility feedback, and creating PRs to address feedback.

Site Editor

In order to keep up with the changes brought by the addition of more features in the Site Editor, including being able to add pages and patterns, the following work was completed:

List View

List View remains an important and powerful tool for navigating complex content. To ensure all can benefit, the following accessibility related efforts were completed:ย 

General blockBlock Block is the abstract term used to describe units of markup that, composed together, form the content or layout of a webpage using the WordPress editor. The idea combines concepts of what in the past may have achieved with shortcodes, custom HTML, and embed discovery into a single consistent API and user experience. editor experience

Work continues to improve the base block experience, especially since improving blocks enhances the experience across all parts of your site. In particular, work to streamline link editing included a specific accessibility focus.ย 

Administration

Upgrade/Install

Other

#6-3

WordPress 6.3 Release Candidate Phase

Now that WordPress 6.3 has entered the Release Candidate phase, the following policies are in place.

These policies mainly cover how and when CoreCore Core is the set of software required to run WordPress. The Core Development Team builds WordPress. committers can commit. For non-committing contributors, this post may help explain why a Core committercommitter A developer with commit access. WordPress has five lead developers and four permanent core developers with commit access. Additionally, the project usually has a few guest or component committers - a developer receiving commit access, generally for a single release cycle (sometimes renewed) and/or for a specific component. makes a certain decision.

String Freeze

To allow the Polyglots teamPolyglots Team Polyglots Team is a group of multilingual translators who work on translating plugins, themes, documentation, and front-facing marketing copy. https://make.wordpress.org/polyglots/teams/ time to get their local languageโ€™s translationtranslation The process (or result) of changing text, words, and display formatting to support another language. Also see localization, internationalization. of WordPress ready, no new strings are permitted to be added to the release. Existing strings can be removed and/or duplicated if needed.

Seek guidance from the Polyglots team leadership for any strings reported as buggy. A buggy string is one that can not be translated to all languages in its current form.ย 

Tickets on the WordPress 6.3 milestone

For the remainder of the cycle, only two types of tickets may be placed on/remain on the 6.3 milestone:

  • Regressions: bugs that have been introduced during the WordPress 6.3 development cycle, either to existing or new features.
  • Test suite expansion: tests can be committed at any time without regard to code or string freezes. This can cover either new or existing features.

Trunktrunk A directory in Subversion containing the latest development code in preparation for the next major release cycle. If you are running "trunk", then you are on the latest revision. is now WordPress 6.4-alpha

WordPress 6.3 was recently forked to its own branch, and trunk is now open for commits for the next version of the software.

Backporting to the 6.3 branchbranch A directory in Subversion. WordPress uses branches to store the latest development code for each major release (3.9, 4.0, etc.). Branches are then updated with code for any minor releases of that branch. Sometimes, a major version of WordPress and its minor versions are collectively referred to as a "branch", such as "the 4.0 branch".

Backporting commits of production code (that is, anything that ends up in the zip file) now requires double sign-off by two core committers. The dev-feedback keyword should be used to request a second committerโ€™s review, dev-reviewed should be added to indicate a second committer has reviewed and approved the commit to the 6.3 branch.

Commits to the test suite do not require double sign-off.

Props to @mikeschroder and @davidbaumwald for peer review.

#6-3, #6-4