Opened 9 months ago

Closed 9 months ago

#35237 closed Cleanup/optimization (fixed)

Optimize system checks for admin actions

Reported by: Adam Johnson Owned by: Adam Johnson
Component: Core (System checks) Version: dev
Severity: Normal Keywords:
Cc: Triage Stage: Ready for checkin
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In ModelAdminChecks, the _check_action_permission_methods and _check_actions_uniqueness both fetch the actions. By combining them, this duplicate work can be eliminated.

Additionally, the lower method ModelAdmin._get_action_description() is wasteful as it computes a default name even when one is defined. This can be deferred and cached.

In a project I’ve profiled, these changes take the admin action checks from 0.86ms (2.1%) to 0.36ms (0.9%).

Change History (4)

comment:1 by Adam Johnson, 9 months ago

Has patch: set
Owner: changed from nobody to Adam Johnson
Summary: ImproveOptimize system checks for admin actions

comment:2 by Mariusz Felisiak, 9 months ago

Triage Stage: UnreviewedAccepted

comment:3 by Mariusz Felisiak, 9 months ago

Triage Stage: AcceptedReady for checkin

comment:4 by Mariusz Felisiak <felisiak.mariusz@…>, 9 months ago

Resolution: fixed
Status: assignedclosed

In 98e6f23:

Fixed #35237 -- Merged system checks for admin actions.

Note: See TracTickets for help on using tickets.
Back to Top