#32312: Performance decrease following implementation of ASGI handler and
coroutine-safety.
-----------------------------------------+------------------------
               Reporter:  David Smith    |          Owner:  nobody
                   Type:  Uncategorized  |         Status:  new
              Component:  Uncategorized  |        Version:  3.0
               Severity:  Normal         |       Keywords:
           Triage Stage:  Unreviewed     |      Has patch:  0
    Needs documentation:  0              |    Needs tests:  0
Patch needs improvement:  0              |  Easy pickings:  0
                  UI/UX:  0              |
-----------------------------------------+------------------------
 #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
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/32312>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.ce60d8e7828fa00923cababeef6d3e9b%40djangoproject.com.

Reply via email to