Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangedFileReader.__init__ is slow on large file #9

Open
philippe-docourt opened this issue Oct 24, 2018 · 0 comments
Open

RangedFileReader.__init__ is slow on large file #9

philippe-docourt opened this issue Oct 24, 2018 · 0 comments

Comments

@philippe-docourt
Copy link

Version

0.1.2

File / Feature

class RangedFileReader(object):
    def __init(...)

Expected behaviour

Obtaining the size of the file should be much quicker, and less CPU intensive. We should probably use something like this:

os.fstat(self.f)
self.size = statobj.st_size

Actual behaviour

The current approach for obtaining the size of the file is terribly slow on large files : it uses CPU and disk I/O
self.size = len(self.f.read())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant