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

Open files larger than available RAM? #382

Open
sopgenorth opened this issue Dec 18, 2022 · 3 comments
Open

Open files larger than available RAM? #382

sopgenorth opened this issue Dec 18, 2022 · 3 comments

Comments

@sopgenorth
Copy link

Is it possible to use AvalonEdit with files that are larger than the available RAM? For example, a setup where only a buffered portion of a file is kept in memory, and updated as the user scrolls.

Are there any examples or pointers available on how to achieve this kind of setup?

@damian-666
Copy link

Don' t know if this will help, but see https://www.codeguru.com/csharp/memory-mapped-files-c-sharp/ Do you mean using this sort of thing? Im curious how easy it would be to just integrate to the existing editors input , but with the disparate immutable partial clones and such for threading and parsing performance, i just saw discussed.. mabye not. also useful examples of usecases are in image processing for large resolution files say Archiectural plots which would require 24Gig at 600 dpi 1 bit. They take a tiling or an pipeline approach and im not sure its trival to just change the stream from a file to a memory map file. Other example is here https://docs.julialang.org/en/v1/stdlib/Mmap/

@sopgenorth
Copy link
Author

Yeah, I think some sort of memory mapped file could work. Might also be able to use FileStream.ReadBytes with the available offset to do a similar thing.

My thoughts were that the strategy used would want to buffer some number of bytes above and below what's currently viewable.

The "interface" for Rope (https://github.com/icsharpcode/AvalonEdit/blob/master/ICSharpCode.AvalonEdit/Utils/Rope.cs) used by the TextDocument seems like it's not too far off from being able to accomodate something like this, as long as the users of it don't just always jump to getting the full text at once...

@sopgenorth
Copy link
Author

There's a plugin for Notepad++ that adds a similar kind of large file support too: https://github.com/superolmo/BigFiles

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

2 participants