﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
35266	Optimize RelatedField._check_clashes()	Adam Johnson	Adam Johnson	"Continuing my project to optimize the system checks, I found some easy optimizations in RelatedField._check_clashes(), which I found to take 6% of the total runtime for checks.

The function was formatting strings for error messages for each potential clash. This formatting is wasted when there is no error, which is the typical case. Moreover, the cost is exacerbated due to using the `Model._meta.label` property, invoking a function call.

Pushing the formatting to error cases speeds up the function significantly. I found this method was called 228 times during system checks for a project with 118 models, taking 4ms or 6% of the total total runtime. After optimizing, the cost is reduced to 1ms, or ~1.5%."	Cleanup/optimization	closed	Core (System checks)	dev	Normal	fixed			Accepted	1	0	0	0	0	0
