Closed fsbraun closed 1 year ago
Merging #1353 (5247c38) into master (e920e55) will increase coverage by
0.13%
. The diff coverage is82.55%
.
@@ Coverage Diff @@
## master #1353 +/- ##
==========================================
+ Coverage 72.41% 72.54% +0.13%
==========================================
Files 72 73 +1
Lines 3284 3311 +27
Branches 534 538 +4
==========================================
+ Hits 2378 2402 +24
- Misses 739 742 +3
Partials 167 167
Impacted Files | Coverage Δ | |
---|---|---|
filer/thumbnail_processors.py | 38.46% <ø> (ø) |
|
filer/admin/fileadmin.py | 78.75% <52.63%> (-8.75%) |
:arrow_down: |
filer/templatetags/filer_admin_tags.py | 88.17% <86.36%> (-0.44%) |
:arrow_down: |
filer/admin/folderadmin.py | 72.81% <87.50%> (+0.87%) |
:arrow_up: |
...der_index_together_remove_folder_level_and_more.py | 100.00% <100.00%> (ø) |
|
filer/models/filemodels.py | 85.58% <100.00%> (-0.07%) |
:arrow_down: |
filer/models/foldermodels.py | 86.36% <100.00%> (+0.37%) |
:arrow_up: |
filer/settings.py | 79.38% <100.00%> (+0.65%) |
:arrow_up: |
Description
When removing
mptt
#1351 once concern were database hits. While getting the full path of a folder with and withoutmptt
requiresn
db hits,n
being the nesting of the current folder typically is small.For directories containing
m
files, the performance bottleneck appeared to be getting the thumbnails requiringm
database hits. Filer limits the number of files per page to 20 to avoid this problem to take excessive time.This PR builds upon #1351 and improves directory listings in filer by
select_related
on a folder's and file'sowner
. This was a classicalm+1
issue with theUser
object.file_icon_url
which is called several times per file when rendering a directory. Also, it needlessly checked for the existence of thumbnails in the db.FileSystemStorage
: Otherwise this tests triggers network connections to the file storage (such as AWS) for each file in the directory.Accompanying changes are:
Further performance improvement lever:
Performance impact
This is just one example: 71 files at nesting level 2 requires
DB queries are independent of folder size (in terms of number of files/folders in that folder) as opposed to between
4m
and13m
.Way forward
This performance improvement is so significant that I suggest dropping the
mptt
dependency and merging the request for version 3.0 even before any major redesign for filer (see #1348). (In a separate upcoming PR, I would like to address minor styling issues, which might also go into 2.3).Related resources
1351
...
Checklist
master