[wp-trac] [WordPress Trac] #34564: WP_List_Table::get_column_info() inefficient
WordPress Trac
noreply at wordpress.org
Tue Nov 3 08:15:14 UTC 2015
#34564: WP_List_Table::get_column_info() inefficient
----------------------------+-----------------------------
Reporter: bobbingwide | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Administration | Version: 4.3
Severity: normal | Keywords:
Focuses: |
----------------------------+-----------------------------
Changes in 4.3 to add a default column have left the logic for
`get_column_info()` very inefficent with `get_primary_column_name()` being
called for every single row being displayed.
In my list table displaying 50 rows the `list_table_primary_column` filter
was invoked 52 times. My `get_columns()` method was called 105 times.
and that meant that the `gettext` filter was invoked 105 times for each of
the defined columns.
That's an awful lot of work for a field which is supposed to have been
cached.
Here's the relevant part of the backtrace
{{{
0. bw_lazy_backtrace C:\apache\htdocs\wordpress\wp-
content\plugins\oik\libs\bwtrace.php:108 0
1. bw_backtrace C:\apache\htdocs\wordpress\wp-
content\plugins\schunter\admin\class-schunter-list-table.php:74 0
2. get_columns C:\apache\htdocs\wordpress\wp-content\plugins\oik\admin
\class-bw-list-table.php:871 0
3. get_default_primary_column_name C:\apache\htdocs\wordpress\wp-
content\plugins\oik\admin\class-bw-list-table.php:898 0
4. get_primary_column_name C:\apache\htdocs\wordpress\wp-
content\plugins\oik\admin\class-bw-list-table.php:936 0
5. get_column_info C:\apache\htdocs\wordpress\wp-content\plugins\oik\admin
\class-bw-list-table.php:1007 0
6. print_column_headers() C:\apache\htdocs\wordpress\wp-
content\plugins\oik\admin\class-bw-list-table.php:1099 1
7. display C:\apache\htdocs\wordpress\wp-
content\plugins\schunter\admin\schunter.php:78 0
}}}
Note: class-bw_list-table.php is basically a copy of class-list-table.php
The code in question is the new logic that doesn't trust $_column_headers,
introduced in #25408.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/34564>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list