Skip to content

Commit

Permalink
Fix #774 - Fix NRTM generator performance on PyPy (#777)
Browse files Browse the repository at this point in the history
Apparently, PyPy deals quite poorly when extending the same string many times, as the old code did. More details in #774 / #777.
  • Loading branch information
mxsasha authored Apr 19, 2023
1 parent d495aa1 commit 87bceb8
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions irrd/mirroring/nrtm_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,18 +79,18 @@ def generate(
.sources([source])
.serial_nrtm_range(serial_start_requested, serial_end_requested)
)
operations = list(database_handler.execute_query(q))

output = f"%START Version: {version} {source} {serial_start_requested}-{serial_end_display}\n"
output = [f"%START Version: {version} {source} {serial_start_requested}-{serial_end_display}\n"]

for operation in operations:
output += "\n" + operation["operation"].value
for operation in database_handler.execute_query(q):
operation_str = operation["operation"].value
if version == "3":
output += " " + str(operation["serial_nrtm"])
operation_str += " " + str(operation["serial_nrtm"])
text = operation["object_text"]
if remove_auth_hashes:
text = remove_auth_hashes_func(text)
output += "\n\n" + text
operation_str += "\n\n" + text
output.append(operation_str)

output += f"\n%END {source}"
return output
output.append(f"%END {source}")
return "\n".join(output)

0 comments on commit 87bceb8

Please sign in to comment.