[buddypress-trac] [BuddyPress Trac] #5644: Activity Favorites: alternative management & new features

buddypress-trac noreply at wordpress.org
Sat May 17 18:13:53 UTC 2014


#5644: Activity Favorites: alternative management & new features
-----------------------------------+------------------
 Reporter:  imath                  |       Owner:
     Type:  enhancement            |      Status:  new
 Priority:  normal                 |   Milestone:  2.1
Component:  Activity               |     Version:  2.0
 Severity:  normal                 |  Resolution:
 Keywords:  has-patch 2nd-opinion  |
-----------------------------------+------------------

Comment (by imath):

 Replying to [comment:1 boonebgorges]:
 > Cool idea. I definitely agree that this kind of functionality is sorely
 missing from activity favorites.
 > ... I have a feeling the differences are going to be very significant

 I've compared the two schemas : you were right, using a new table for
 favorites is globally better, we gain an average of '''45%''' in query
 performances.

 There are 2 contexts where it's not the case, but numbers are really
 close. The gain can be up to '''66%''' when adding a favorite.

 You can see the detail of my tests on this
 [https://docs.google.com/spreadsheets/d/17bMFm-
 t7MusfKJ1IkkqyJg1CONVYY6PGJ2LI17tbmko/edit?usp=sharing gdoc excel sheet]
 I wanted to have more than 1 favorite for each activity, this explains the
 choices i've made on the data generated (100 users, 2300 activities &
 13400 favorites)

 As i compared all the features, i kept on building an upgrade routine for
 this new table, just in case. So
 ''5644.bp_activity_favorites_table.patch'' is using this schema. I think
 it can be improved again for the 'add favorite' & 'remove favorite' as we
 could do a
 {{{
 SELECT activity_id WHERE activity_id = [to_favorite] AND user_id =
 [bp_loggedin_user_id()]
 }}}
 to check if the 'to favorite' activity is already favorited instead of
 getting all the favorites to see if the one to favorite is in the array or
 not. Maybe some caching could also be done at some places.

 I'm also attaching to this ticket the wp-cli command (''5644.wp-cli-
 bp.diff'') i've used so that you can check if i did right ;)
 NB: to make the command run you'll need to comment the is_user_logged_in()
 check that the function {{{bp_activity_add_user_favorite()}}} is doing.

 I really think it could be a nice feature ;)

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/5644#comment:2>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list