PHP Filter on Views


I’m pretty new on Drupal, and I was working on a site that it uses Drupal 7 (7.50). I’ve made a view for the home page but then I needed to filter some content comparing some field of the author with the same field of the current user who was browsing the site. I did it by using PHP filter and actually works. But the problem is the site is horribly slow since then. I’d tried to enhance it by adding caching tools to manage workloads but I can’t get it faster enough again. It takes up to 40 seconds to load most of the time.
It seems that it applies the filter to ALL the content before it shows the first page, even when only 10 items are loaded per page. Additionally I’m using Views Infinite Scroll.
I would really appreciate any guidance or advice, or maybe how to approach my problem with some other workaround

Thank you in advance,

Drupal version: