Skip to content

Commit 3e03df8

Browse files
committed
Use JSON.parse for the diff
Inspired by rust-lang/rust#71250. In short, it's a lot faster to parse. Because our index is roughly 1MB, this may help speed up the initial page load.
1 parent eda5031 commit 3e03df8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

get-all-tl.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,9 +238,9 @@ def main():
238238
extract()
239239
load_tl()
240240
with open('diff.js', 'w') as fd:
241-
fd.write('DIFF=')
242-
json.dump(gen_index(), fd, indent=0, separators=(',', ':'), sort_keys=True)
243-
fd.write('\n')
241+
fd.write('DIFF=JSON.parse(')
242+
fd.write(repr(json.dumps(gen_index(), separators=(',', ':'), sort_keys=True)))
243+
fd.write(');\n')
244244

245245
if __name__ == '__main__':
246246
main()

0 commit comments

Comments
 (0)