1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-10-05 18:50:09 +02: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:
Daniel Martí 2016-01-11 13:25:03 +01:00
parent 7f6276889e
commit d98b4d1b83

View File

@ -842,17 +842,14 @@ esc_newlines = re.compile(r'\\( |\n)')
# This function uses __dict__ to be faster
def post_metadata_parse(app):
for k, v in app.__dict__.items():
if k not in app._modified:
continue
for k in app._modified:
v = app.__dict__[k]
if type(v) in (float, int):
app.__dict__[k] = str(v)
for build in app.builds:
for k, v in build.__dict__.items():
if k not in build._modified:
continue
for k in build._modified:
v = build.__dict__[k]
if type(v) in (float, int):
build.__dict__[k] = str(v)
continue