Make WordPress Core

Opened 10 years ago

Closed 10 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:


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 10 years ago.
ajax_load_all_categories.diff (10.9 KB) - added by ryan 10 years ago.

Download all attachments as: .zip

Change History (12)

10 years ago

#1 @ryan
10 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

#2 @ryan
10 years ago

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

#3 @ryan
10 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.

#4 @ryan
10 years ago

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

#5 @ryan
10 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.

#6 @Viper007Bond
10 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.

#7 @ryan
10 years ago

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

#8 @ryan
10 years ago

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

#9 @mdawaffe
10 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.

#10 @ryan
10 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.