I am working with serialized array fields in one of my models, specifically in counting how many members of each array are shared.
Now, by the nature of my project, I am having to a HUGE number of these overlap countings.. so I was wondering if there was a super quick, cleaver way to do this.
At the moment, I am using the ‘&’ method, so my code looks like this
(user1.follower_names & user2.follower_names).count
which works fine… but I was hoping there might be a faster way to do it.
Sets are faster for this.
Output: