[wp-trac] [WordPress Trac] #51678: [5.6 Beta] Performance regression with i10n changes when translations files are not present

WordPress Trac noreply at wordpress.org
Mon Nov 9 05:27:20 UTC 2020


#51678: [5.6 Beta] Performance regression with i10n changes when translations files
are not present
-------------------------------------------------+-------------------------
 Reporter:  vedjain                              |       Owner:  (none)
     Type:  defect (bug)                         |      Status:  new
 Priority:  high                                 |   Milestone:  5.6
Component:  I18N                                 |     Version:  trunk
 Severity:  normal                               |  Resolution:
 Keywords:  needs-testing dev-feedback has-      |     Focuses:
  patch                                          |  performance
-------------------------------------------------+-------------------------

Comment (by vedjain):

 To add on more info, this will impact any plugin/theme which does not have
 `.mo` file present for the currently loaded domain.

 I used this small benchmarking code to assess:
 {{{#!php
 <?php
         load_plugin_textdomain( 'domain_xyz' );

         $time_start = microtime( true );
         for( $i = 0; $i < 5000; $i++ ) {
                 __( 'Any text ' . $i, 'domain_xyz' );
         }
         $end_time = microtime( true ) - $time_start;
         echo $end_time;
 }}}

 In trunk, the output was `0.22249007225037` whereas in branch 5.5, output
 was `0.011736869812012` which implies every translation call getting about
 20x slower. (I went on vacation immediately after opening this ticket, so
 that's why the delay of response).

 After applying patches separately by @ocean90 and @peterfabian1000, these
 figures are improved, but it's still at ` 0.12674498558044` which is still
 about 10x slower than in 5.5, so perhaps something is still missing in
 that patch, although I have not figured it out yet.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/51678#comment:22>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list