New submission from umaxx: here comes a simple patch for linecache core module, which does the following:
- remove double comment - instead of adding all lines with readlines() to the cache, just add seek points for every line - return lines from cached seek-points instead directly from dict-cache advantages of this patch: - reading lines from very big files (>1GB) is no problem anymore - linecache can handle a large number of large files now - updatecache() is faster now because "for line in fp:" is faster than readlines() disadvantages: - reading a single line from cache will be a little bit slower, then before because of extra open() call to the file summary: - this diff presents a different caching approach which is able to handle a lot of large files too __future__-work: - the code is ugly and unstructured, someone needs to beautify it - an extra function: get_list_of_lines_from_list_of_linenumbers() would be nice to have - test-cases for cache-consistence would be nice to have ---------- components: Library (Lib) files: linecache.py.diff messages: 59041 nosy: umaxx severity: minor status: open title: improvements for linecache type: behavior versions: Python 3.0 Added file: http://bugs.python.org/file9036/linecache.py.diff __________________________________ Tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue1708> __________________________________
linecache.py.diff
Description: Binary data
_______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com