﻿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
32312	Performance decrease following implementation of ASGI handler and coroutine-safety.	David Smith	nobody	"#30451 added the ASGI handler and coroutine-safety. 

I've spotted that this resulted in a number of the djangobench benchmarks taking longer to run, in some cases there are quite large impacts. I'll attach the full log from my run, but I found djangobench does not give repeatable outputs. I found that cpu isolation with `pyperf` helps to give repeatable outputs, and have been using the `asv` tool as a runner for this. 

I've not re-created all of the benchmarks yet, but I have run a few [https://github.com/smithdc1/django-asv see here] to be more certain about the performance impacts before opening this ticket. Comparing the commit [https://github.com/django/django/commit/a415ce70 in question] to the previous commit, I get the table below. A range of benchmarks see a performance decrease of c20%-50%. `url_reverse()` seems to be an outlier which is very materially impacted at c140% slower. 

I'm not sure if anything can be done about this, but thought it worth flagging as I couldn't see any previous discussion on this topic. 


{{{
.       before           after         ratio
     [cce47ff6]       [a415ce70]
     <3.0a1~249>       <3.0a1~248>
+         474±7μs      1.15±0.01ms     2.43  bench_urls.URLBenchmarks.time_url_reverse
+         656±3μs      1.01±0.01ms     1.54  forms.FormBenchmarks.time_create_form
+      17.9±0.6ms       27.1±0.2ms     1.52  bench_urls.URLBenchmarks.time_url_resolve
+        464±20μs         698±20μs     1.50  query.QueryDelete.time_query_delete
+      35.5±0.3ms       45.2±0.9ms     1.27  bench_models.ModelBenchmarks.time_save_new
+     1.68±0.02ms      2.09±0.02ms     1.25  bench_models.ModelBenchmarks.time_model_creation
+     4.83±0.06ms       5.92±0.3ms     1.23  query.QueryCount.time_query_count
+     2.20±0.03ms      2.62±0.04ms     1.19  query.QueryGetOrCreate.time_query_get_or_create
+     1.91±0.07ms      2.20±0.03ms     1.15  query.QueryGet.time_query_get
+         192±2ms          218±1ms     1.14  bench_urls.URLBenchmarks.time_url_resolve_flat
}}}
"	Cleanup/optimization	new	Core (Other)	3.0	Normal		async	Andrew Godwin Adam Johnson Ülgen Sarıkavak	Accepted	0	0	0	0	0	0
