Skip to content

Commit d5c2b31

Browse files
zingofreddan80
authored andcommitted
Arm backend: Speedup generation of C/C++ header of the pte file
This fix a problem where Python 3.12.3 was slower then 3.10 to handle this part of the code. Signed-off-by: Zingo Andersen <[email protected]> Change-Id: I116a3be950cd4016d40e1debb6bc237c07e9425e
1 parent 4c68660 commit d5c2b31

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

examples/arm/executor_runner/pte_to_header.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ def input_file_path(path):
6464
with open(args.pte, "rb") as fr, open(outfile, "w") as fw:
6565
data = fr.read()
6666
hexstream = binascii.hexlify(data).decode("utf-8")
67-
hexstring = attr + "model_pte[] = {"
67+
fw.write(attr + "model_pte[] = {")
6868

6969
for i in range(0, len(hexstream), 2):
7070
if 0 == (i % hex_digits_per_line):
71-
hexstring += "\n"
72-
hexstring += "0x" + hexstream[i : i + 2] + ", "
71+
fw.write("\n")
72+
fw.write("0x" + hexstream[i : i + 2] + ", ")
73+
74+
fw.write("};\n")
7375

74-
hexstring += "};\n"
75-
fw.write(hexstring)
7676
print(
77-
f"Input: {args.pte} with {len(data)} bytes. Output: {outfile} with {len(hexstring)} bytes. Section: {args.section}."
77+
f"Input: {args.pte} with {len(data)} bytes. Output: {outfile} with {fw.tell()} bytes. Section: {args.section}."
7878
)

0 commit comments

Comments
 (0)