After testing out several ways to build custom Like buttons and up/down voting systems, I’ve discovered the fastest method.
What doest work
At first it might seem obvious to implement a workflow that adds +1 to a like button or upvote. However, this makes it hard to keep track if current user has already added a like or a vote, and makes it near impossible to then “unlike” the liked post.
Another method is to have a “likes” database. Then to retrieve the total likes or upvotes is to do a search for all the people that have liked a post. This, as you might expect, is very slow.
The fastest method
The fastest method that I’ve found is to add a data field inside a post type “list of users”. Every time a user clicks “like”, the user is added to that list. If the user clicks “like” again, you remove the user (with the conditional, only when: if this list contains current user, remove ). So retrieve total list simply do a list :count.
This has proven to be the fastest in terms of like - dislike dynamics, and vote up, vote down dyanmics.
If anyone else wants to chime in and add their method, would be delighted to hear.
Hope this helps!