Skip to content

Load partial files lazily for preview  #2256

Open
@swarnimarun

Description

@swarnimarun

Is your feature request related to a problem? Please describe.
If you have large files in your repo, gitui tries to load more than what is required, and it seems to block the ui partially, and causes application to freeze for a few seconds depending on the performance of the machine, it almost froze on my rpi, but it was just a 1-2 second stutter on my workstation.

Describe the solution you'd like
I am unsure about the implementation. But it should provide lazy "partial" file loading for previews so that it only loads the first N bytes required for displaying the preview. It should be fairly easy to implement it irrespective of platform and will help avoid the cost of fetching large files.

Also, I am not entirely sure if this is a feature request but as it didn't feel fair calling it a bug so here it is.

Describe alternatives you've considered
None, I can't think of any other solutions, in case it's already implemented it might be worth looking into why it stutters with large files, we can also directly back the preview with Mmap to ensure not more than the part of the file required for preview is loaded (I haven't written interactive tui in rust much, so I am unsure, but I think it shouldn't be hard to implement).

Additional context
Will try to find time to implement it, also have a look at gitui code base while I am at it.

I don't use gitui much, but it's a nice to have, to stage changes partially, thanks for the hard work folks.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions