django-countries icon indicating copy to clipboard operation
django-countries copied to clipboard

Version 5.5 is 2.5 times faster than 6.0 and 7.0

Open nipmarsh opened this issue 4 years ago • 2 comments

Hi,

I experience slowness when upgrading from 5.5 to 6.0 or 7.0. 5.5 is 2.5 faster than those versions I'm using python 3.9, django 3.1.5 and restframework 3.12.2

This is related to pyuca install, if not install the speed is good

nipmarsh avatar Jan 23 '21 13:01 nipmarsh

Could it be related to the pyuca version? Otherwise if you have time, run a bisect and find when the problem started to help narrow it down :)

SmileyChris avatar Feb 15 '21 08:02 SmileyChris

Python 3.9.2 django-countries==7.0

models.py

class Country(models.Model):
    country = CountryField(unique=True)

    created = models.DateTimeField(auto_now_add=True)
    updated = models.DateTimeField(auto_now=True, db_index=True)

    class Meta:
        ordering = ['id']

    def __str__(self):
        return '%s' % self.country

admins.py

@admin.register(Country)
class CountryAdmin(admin.ModelAdmin):
    list_per_page = 25
    list_display = ('id', 'country', 'created', 'updated',)

Page load time tests in the admin panel (3 attempts): No pyuca:

  1. 0,459s
  2. 0.305s
  3. 0.390s

pyuca==1.2:

  1. 9.07s
  2. 8.86s
  3. 9.02s

pyuca==1.1.2:

  1. 7.17s
  2. 7.42s
  3. 7.42s

pyuca==1.1.1:

  1. 7.32s
  2. 7.32s
  3. 7.28s

maksam07 avatar Feb 21 '21 08:02 maksam07