Skip to:
Content

bbPress.org


Ignore:
Timestamp:
06/14/2017 06:45:49 PM (9 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/topics/template.php

    r6533 r6544  
    42574257     *
    42584258     * @uses bbp_is_topic_edit() To check if it's the topic edit page
    4259      * @uses bbp_is_user_subscribed_to_topic() To check if the user is
    4260      *                                          subscribed to the topic
     4259     * @uses bbp_is_user_subscribed() To check if the user is subscribed
    42614260     * @uses apply_filters() Calls 'bbp_get_form_topic_subscribed' with the
    42624261     *                        option
     
    42774276            // Post author is not the current user
    42784277            if ( bbp_get_current_user_id() !== $post_author ) {
    4279                 $topic_subscribed = bbp_is_user_subscribed_to_topic( $post_author );
     4278                $topic_subscribed = bbp_is_user_subscribed( $post_author, bbp_get_topic_id() );
    42804279
    42814280            // Post author is the current user
    42824281            } else {
    4283                 $topic_subscribed = bbp_is_user_subscribed_to_topic( bbp_get_current_user_id() );
     4282                $topic_subscribed = bbp_is_user_subscribed( bbp_get_current_user_id(), bbp_get_topic_id() );
    42844283            }
    42854284
    42864285        // Get current status
    42874286        } elseif ( bbp_is_single_topic() ) {
    4288             $topic_subscribed = bbp_is_user_subscribed_to_topic( bbp_get_current_user_id() );
     4287            $topic_subscribed = bbp_is_user_subscribed( bbp_get_current_user_id(), bbp_get_topic_id() );
    42894288
    42904289        // No data
Note: See TracChangeset for help on using the changeset viewer.