[issue17183] Small enhancements to Lib/_markupbase.py

2013-02-21 Thread Ezio Melotti
Changes by Ezio Melotti : -- keywords: +patch Added file: http://bugs.python.org/file29158/issue17183.diff ___ Python tracker ___ ___

[issue17183] Small enhancements to Lib/_markupbase.py

2013-02-21 Thread Ezio Melotti
Ezio Melotti added the comment: I did some macro-benchmarks and the proposed changes don't seem to affect the result (most likely because they are in _parse_doctype_element and _parse_doctype_attlist which should be called only once per document). I did some profiling, and this is the result:

[issue17183] Small enhancements to Lib/_markupbase.py

2013-02-16 Thread Guido Reina
Guido Reina added the comment: I am attaching a .tgz file with the tests I have performed. The .tgz file contains also a README.txt file with more detailed information. I have done the following test: The script loads the HTML file 'search.html' in 'rawdata' and searches '>' in a loop from the

[issue17183] Small enhancements to Lib/_markupbase.py

2013-02-15 Thread Ezio Melotti
Ezio Melotti added the comment: I would still do a benchmark, for these reasons: 1) IIRC rawdata might be the whole document (or at least everything that has not been parsed yet); 2) the '>' is very likely to be found; This situation is fairly different from the one presented in #17170, where t

[issue17183] Small enhancements to Lib/_markupbase.py

2013-02-15 Thread Terry J. Reedy
Terry J. Reedy added the comment: 'Enhancement' issues are for visible behavior additions (or occasionally, changes). This is intended to be an invisible small speedup, hence it is a 'performance' issue, and gets a different title. As explained in #17170, the change will not be a speedup if th

[issue17183] Small enhancements to Lib/_markupbase.py

2013-02-15 Thread Ezio Melotti
Ezio Melotti added the comment: We should add some benchmarks to see if there is any difference between the two forms. -- ___ Python tracker ___

[issue17183] Small enhancements to Lib/_markupbase.py

2013-02-11 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: > if '>' in rawdata[j:]: > return rawdata.find(">", j) + 1 See issue17170 for this idiom. -- nosy: +serhiy.storchaka ___ Python tracker _

[issue17183] Small enhancements to Lib/_markupbase.py

2013-02-11 Thread Ezio Melotti
Changes by Ezio Melotti : -- assignee: -> ezio.melotti components: +Library (Lib) nosy: +ezio.melotti stage: -> needs patch versions: -Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3, Python 3.5 ___ Python tracker

[issue17183] Small enhancements to Lib/_markupbase.py

2013-02-11 Thread Guido Reina
New submission from Guido Reina: In the file: Lib/_markupbase.py, function: "_parse_doctype_element" there is: if '>' in rawdata[j:]: return rawdata.find(">", j) + 1 rawdata[j:] is being scanned twice. It would be better to do: pos = rawdata.find(">", j) if pos != -1: return pos + 1