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

Lazy loading datasets: Change default chunk size? #29

Closed
isimonsm opened this issue Jun 29, 2022 · 3 comments
Closed

Lazy loading datasets: Change default chunk size? #29

isimonsm opened this issue Jun 29, 2022 · 3 comments

Comments

@isimonsm
Copy link

Hello!
I am currently using the feature you described in this issue to handle loading large files from our server:
#4 (comment)

The lazy loading works great, but currently datasets are always loaded in chunks of 1MB, which affects the performance greatly on large datasets. Is there any way to change the chunk size? I tried to find a solution in your documentation and in emscripten, but cannot find any mention on how to control this.
Thank you for this great library btw!

@bmaranville
Copy link
Member

The chunk size is hardcoded in the Emscripten source here: https://github.com/emscripten-core/emscripten/blob/main/src/library_fs.js#L1714

As an alternative, you could use this if you like - it allows you to specify the chunk size at initialization time. It is based on the Emscripten code (through the SQL.js version of the lazyFile loader) https://github.com/bmaranville/lazyFileLRU

@bmaranville
Copy link
Member

You could also modify the library_fs.js file yourself, and load your custom lazyFile implmentation with your page - the virtual FS initializer can be hooked into the FS object after the webassembly is loaded (that is how the lazyFileLRU code works, too)

@isimonsm
Copy link
Author

Thank you for the quick answer, the lazyFileLRU implementation worked for me.

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