shakna-israel / docbuilder

Build Python Technical Documentation from Literate Programming Programs
http://docbuilder.rtfd.org
MIT License
1 stars 0 forks source link

Read Once, Write Once #81

Closed shakna-israel closed 9 years ago

shakna-israel commented 9 years ago

Rather than streaming input in, opening and closing before each line to try and accommodate for race conditions, simply bite the bullet and preload files.

Load the entire file into a list, and close it. Parse it from memory and build the entire output into memory, and then write it.

Race conditions can be mentioned, like

if file hash changed:
    print("Input file may have changed... Continue?")
shakna-israel commented 9 years ago

This obviously increases the memory docbuilder may use exponentially, but it should benefit from a speed increase.

shakna-israel commented 9 years ago

Solved by a4a43b8fb02cdd217b539861649b2d953f7dfbd7.