Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
DHParser
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Analytics
Analytics
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
badw-it
DHParser
Commits
b930b98d
Commit
b930b98d
authored
Aug 30, 2017
by
Eckhart Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- parser.py: added a comment on motivation for new memoization algorithm
parent
b75d6237
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
1 deletion
+6
-1
DHParser/parser.py
DHParser/parser.py
+5
-0
examples/LaTeX/tst_LaTeX_docs.py
examples/LaTeX/tst_LaTeX_docs.py
+1
-1
No files found.
DHParser/parser.py
View file @
b930b98d
...
...
@@ -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
...
...
examples/LaTeX/tst_LaTeX_docs.py
View file @
b930b98d
...
...
@@ -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
[:
2
0
]:
for
stat
in
top_stats
[:
4
0
]:
print
(
stat
)
if
__name__
==
"__main__"
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment