NickHugi / PyKotor

A Python library that can read and modify most file formats used by the game Knights of the Old Republic and its sequel.
GNU Lesser General Public License v3.0
11 stars 3 forks source link

Attempt to buffer streams before reading #82

Closed th3w1zard1 closed 5 months ago

th3w1zard1 commented 5 months ago

Reduce 1-byte read calls that are potentially slowing down all IO operations on large files.

th3w1zard1 commented 5 months ago

This whole PR is a stupid idea based on naive logic. Python already has a io.BufferedReader object, simply doing a isinstance(stream, io.RawIOBase) and creating a new io.BufferedReader inside from_stream does much better than this PR.