mirror of
https://github.com/f-droid/fdroidserver.git
synced 2025-09-14 06:52:39 +03:00
metadata: slightly speed up post_metadata_parse
Iterating over all the fields and checking which are modified is slower than just iterating over the modified ones.
This commit is contained in:
parent
7f6276889e
commit
d98b4d1b83
1 changed files with 4 additions and 7 deletions
|
@ -842,17 +842,14 @@ esc_newlines = re.compile(r'\\( |\n)')
|
||||||
# This function uses __dict__ to be faster
|
# This function uses __dict__ to be faster
|
||||||
def post_metadata_parse(app):
|
def post_metadata_parse(app):
|
||||||
|
|
||||||
for k, v in app.__dict__.items():
|
for k in app._modified:
|
||||||
if k not in app._modified:
|
v = app.__dict__[k]
|
||||||
continue
|
|
||||||
if type(v) in (float, int):
|
if type(v) in (float, int):
|
||||||
app.__dict__[k] = str(v)
|
app.__dict__[k] = str(v)
|
||||||
|
|
||||||
for build in app.builds:
|
for build in app.builds:
|
||||||
for k, v in build.__dict__.items():
|
for k in build._modified:
|
||||||
|
v = build.__dict__[k]
|
||||||
if k not in build._modified:
|
|
||||||
continue
|
|
||||||
if type(v) in (float, int):
|
if type(v) in (float, int):
|
||||||
build.__dict__[k] = str(v)
|
build.__dict__[k] = str(v)
|
||||||
continue
|
continue
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue