WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#6677 closed defect (bug) (fixed)

JS is horribly inefficient on Write -> Post/Link pages when lots of categories

Reported by: mdawaffe Owned by: mdawaffe
Milestone: 2.5.1 Priority: normal
Severity: normal Version: 2.5
Component: General Keywords: has-patch needs-testing
Focuses: Cc:

Description

There are probably lots of inefficiencies. This patch addresses two.

  1. Whenever a checkbox in "All Categories" is checked/unchecked, it syncs that new checked state with it's partner in "Most Used" and vice versa.
  2. On load (and maybe unload in some browsers during some kind of cleanup), wp-lists looks at each category checkbox and makes huge arrays. This is so that the current checked state of all category checkboxes is known (needed for ajax addition of categories).

The attached fixes:

  1. By only syncing the categories that are in both lists. To do this, various wp-admin/include/template functions have been tweaked so that they can be aware of what categories are popular.
  2. By vastly reducing the number of inputs wp-lists looks at on load and making slight efficiency tweaks to wp-lists.

Attachments (2)

6677.diff (7.7 KB) - added by mdawaffe 6 years ago.
ajax_load_all_categories.diff (10.9 KB) - added by ryan 6 years ago.

Download all attachments as: .zip

Change History (12)

mdawaffe6 years ago

comment:1 ryan6 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [7669]) More efficient category and list JS from mdawaffe. fixes #6677 for trunk

comment:2 ryan6 years ago

(In [7670]) More efficient category and list JS from mdawaffe. fixes #6677 for 2.5

comment:3 ryan6 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Reopening to tack on some more category list improvements.

Attached is some work by mdawaffe that AJAX loads the category list when you click on the "All Categories" tab.

comment:4 ryan6 years ago

(In [7689]) Demand load the category list. Props mdawaffe. see #6677

comment:5 ryan6 years ago

This doesn't degrade nicely with JS turned off. We'll try it in trunk and work the kinks out. Not ready for the 2.5 branch.

comment:6 Viper007Bond6 years ago

Can we make, via a plugin or whatnot, some easy method of keeping the "All Categories" the default? I hate the most-used view and never use it.

comment:7 ryan6 years ago

Maybe open the last tab used like we do with the editor.

comment:8 ryan6 years ago

(In [7720]) Revert [7689], gonna try another approach. see #6677

comment:9 mdawaffe6 years ago

One major improvement that can be made is that the Parent Category select dropdown in the Add New Category section and the list of checkboxes in the All Categories section display the same information, but use different queries/logic so we get no cache benefit.

comment:10 ryan6 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Calling this fixed. Issues mentioned can be handled in other tickets.

Note: See TracTickets for help on using tickets.