Skip to:
Content

bbPress.org


Ignore:
Timestamp:
06/14/2017 06:45:49 PM (8 years ago)
Author:
johnjamesjacoby
Message:

Performance: Last pass at 2.6 performance tuning.

  • Keep a local cache of non-options that aren't in the database, to avoid multiple database misses for options we know aren't in the database after wp_load_alloptions() is called
  • Stop getting all favorite IDs and subscription IDs when checking if a user has favorited or subscribed to something, because these queries are expensive joins that are difficult to cache & invalidate
  • Consolidate forum/topic favorites & subscriptions logic back into central routers, to make it easier to handle taxonomy term subscriptions in the future, and remove nested filter calls that make the call-stack confusing
  • Informally deprecate some forum & topic specific fav/sub functions
  • Rename one of the engagements remove functions to better match existing naming pattern
  • Typo fixes & general code quality improvements
  • Bump slow tests threshold up to 500 for now, and we can bring back down later (my 12" MacBook runs this pretty slowly, so I'd like to play with this more)
  • Unit tests are all passing, and more quickly, maybe surprisingly

This should result in around 20 fewer database hits on non-persistent-cache sites, on average. When viewing single topics & replies, this will result in more than 25 fewer database hits.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/includes/forums/functions.php

    r6534 r6544  
    10731073
    10741074/**
    1075  * Remove a deleted forum from all users' subscriptions
     1075 * Remove a deleted forum from all user subscriptions
    10761076 *
    10771077 * @since 2.5.0 bbPress (r5156)
     
    10901090    }
    10911091
     1092    // Bail if no forum
    10921093    $forum_id = bbp_get_forum_id( $forum_id );
    1093 
    1094     // Bail if no forum
    10951094    if ( empty( $forum_id ) ) {
    10961095        return;
    10971096    }
    10981097
    1099     // Get users
    1100     $users = (array) bbp_get_forum_subscribers( $forum_id );
    1101 
    1102     // Users exist
    1103     if ( ! empty( $users ) ) {
    1104 
    1105         // Loop through users
    1106         foreach ( $users as $user ) {
    1107 
    1108             // Remove each user
    1109             bbp_remove_user_subscription( $user, $forum_id );
    1110         }
    1111     }
     1098    // Remove forum from all subscriptions
     1099    return bbp_remove_object_from_all_users( $forum_id, '_bbp_subscription', 'post' );
    11121100}
    11131101
Note: See TracChangeset for help on using the changeset viewer.