You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Symfony 5.4 introduced cacheable Voters, which speed up apps, which use a lot of is_granted calls.
You can define which attributes the Voter supports, and thus it will not be called for other attributes.
In one of my apps, I opened the profiler for a listing page, which triggers around 1000 is_granted calls.
Each of them calls Scheb\TwoFactorBundle\Security\Authorization\Voter\TwoFactorInProgressVoter in addition to the specific app Voter, see this example screenshot:
Description
Symfony 5.4 introduced cacheable Voters, which speed up apps, which use a lot of
is_granted
calls.You can define which attributes the Voter supports, and thus it will not be called for other attributes.
In one of my apps, I opened the profiler for a listing page, which triggers around 1000
![Bildschirmfoto 2024-04-17 um 21 35 00](https://private-user-images.githubusercontent.com/533162/323355813-9143dcf5-b5d5-44ac-8397-66796b6a6d6a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjE0MTU0MTMsIm5iZiI6MTcyMTQxNTExMywicGF0aCI6Ii81MzMxNjIvMzIzMzU1ODEzLTkxNDNkY2Y1LWI1ZDUtNDRhYy04Mzk3LTY2Nzk2YjZhNmQ2YS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNzE5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDcxOVQxODUxNTNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kYWM3NzFiNjI1MTg0ZTAzMWQ5MzgzMmNjNjAzNDQxNjU4N2JlYjUyZDdiMGQ2ZmZmNjk4YzliZjZhMDA4YzU3JlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.ZBViPJNOC7abgiOZhgvY1TlgMRwK-4dVBX730CCPZkc)
is_granted
calls.Each of them calls
Scheb\TwoFactorBundle\Security\Authorization\Voter\TwoFactorInProgressVoter
in addition to the specific app Voter, see this example screenshot:By changing the voter to this
I was able to remove the Voter from almost all of the 1k
is_granted
decisions:Which reduced the time from this:
to this:
A pretty low hanging fruit, which I'd like to address in a PR if that's okay!?
Or is there anything I am missing?
The text was updated successfully, but these errors were encountered: