Skip to content

RangedFileReader.__init__ is slow on large fileΒ #9

@philippe-docourt

Description

@philippe-docourt

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())

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions