Notice to GitKraken users: A vulnerability has been found in the SSH key generation of GitKraken versions 7.6.0 to 8.0.0 (https://www.gitkraken.com/blog/weak-ssh-key-fix). If you use GitKraken and have generated a SSH key using one of these versions, please remove it both from your local workstation and from your LRZ GitLab profile.

21.10.2021, 9:00 - 11:00: Due to updates GitLab may be unavailable for some minutes between 09:00 and 11:00.

Commit b930b98d authored by Eckhart Arnold's avatar Eckhart Arnold
Browse files

- parser.py: added a comment on motivation for new memoization algorithm

parent b75d6237
......@@ -235,6 +235,11 @@ def add_parser_guard(parser_func):
rlen = location - (0 if node is None else node.len)
rest = grammar.document__[-rlen:] if rlen else ''
return node, rest
# NOTE: An older and simpler implementation of memoization
# relied on `parser.visited[location] == node, rest`. Although,
# rest is really just a substring of one and the same document,
# this resulted in an explosion of memory usage. Seems as if
# `rext = text[i:]` really copies the sub-string!?
try:
location = len(text) # mind that location is always the distance to the end
......
......@@ -83,7 +83,7 @@ def mem_profile(func):
snapshot = tracemalloc.take_snapshot()
top_stats = snapshot.statistics('lineno')
print("[ Top 20 ]")
for stat in top_stats[:20]:
for stat in top_stats[:40]:
print(stat)
if __name__ == "__main__":
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment