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

Slow for very large folders #22

Closed
adambarnett52 opened this issue Jul 1, 2022 · 6 comments
Closed

Slow for very large folders #22

adambarnett52 opened this issue Jul 1, 2022 · 6 comments

Comments

@adambarnett52
Copy link

adambarnett52 commented Jul 1, 2022

Hi There

Is there a way to speed this up for very large folder ( aprox 63TB) it take a long time to calculate
I am using it as such

stats.size = await getFolderSize.loose(p);

Thanks
adam

update, i dont need file sizes just folder

@atjn
Copy link
Collaborator

atjn commented Jul 27, 2022

Hello Adam

This package is not the fastest because it strikes a balance between usability, maintainability, and speed. There might be some way to shuffle the code around to improve speed without impacting the other concerns, but it is not obvious - you are very welcome to experiment with that and submit a PR if you find anything.

You can take the code from this package and improve it specifically for speed in your use case. One big thing you can do, is implement multi-threaded folder traversal, which would utilize all of your CPU's power, compared to the single core that this package uses. We might even accept a PR to add that functionality here as well.

If you want the absolute best performance, you should look into rewriting the code in Rust and compiling it to WebAssembly. That has the potential to significantly improve speed, but it is hard to say how big the improvement will really be.

Other than that, I can only think of maybe using a faster runtime engine, such as Bun.

@adambarnett52
Copy link
Author

Thanks will take a look

@markthree
Copy link

Hello Adam

This package is not the fastest because it strikes a balance between usability, maintainability, and speed. There might be some way to shuffle the code around to improve speed without impacting the other concerns, but it is not obvious - you are very welcome to experiment with that and submit a PR if you find anything.

You can take the code from this package and improve it specifically for speed in your use case. One big thing you can do, is implement multi-threaded folder traversal, which would utilize all of your CPU's power, compared to the single core that this package uses. We might even accept a PR to add that functionality here as well.

If you want the absolute best performance, you should look into rewriting the code in Rust and compiling it to WebAssembly. That has the potential to significantly improve speed, but it is hard to say how big the improvement will really be.

Other than that, I can only think of maybe using a faster runtime engine, such as Bun.

I implemented one with go. Currently, cli is faster than the Current package。Later, I will improve a version of WebAssembly 🥰

👉 markthree/go-get-folder-size

@atjn
Copy link
Collaborator

atjn commented Jan 26, 2023

@markthree nice work!

@markthree
Copy link

Hello Adam
This package is not the fastest because it strikes a balance between usability, maintainability, and speed. There might be some way to shuffle the code around to improve speed without impacting the other concerns, but it is not obvious - you are very welcome to experiment with that and submit a PR if you find anything.
You can take the code from this package and improve it specifically for speed in your use case. One big thing you can do, is implement multi-threaded folder traversal, which would utilize all of your CPU's power, compared to the single core that this package uses. We might even accept a PR to add that functionality here as well.
If you want the absolute best performance, you should look into rewriting the code in Rust and compiling it to WebAssembly. That has the potential to significantly improve speed, but it is hard to say how big the improvement will really be.
Other than that, I can only think of maybe using a faster runtime engine, such as Bun.

I implemented one with go. Currently, cli is faster than the Current package。Later, I will improve a version of WebAssembly 🥰

👉 markthree/go-get-folder-size

I tested that wasm implemented with go cannot call the io api 😂
After investigation, it is found that esbuild is also a subprocess call 😂
Go's wasm seems to be for the browser at the beginning 😵
It seems that for go users, it can only be compiled into binary executable files 🥵

@markthree
Copy link

Hello Adam
This package is not the fastest because it strikes a balance between usability, maintainability, and speed. There might be some way to shuffle the code around to improve speed without impacting the other concerns, but it is not obvious - you are very welcome to experiment with that and submit a PR if you find anything.
You can take the code from this package and improve it specifically for speed in your use case. One big thing you can do, is implement multi-threaded folder traversal, which would utilize all of your CPU's power, compared to the single core that this package uses. We might even accept a PR to add that functionality here as well.
If you want the absolute best performance, you should look into rewriting the code in Rust and compiling it to WebAssembly. That has the potential to significantly improve speed, but it is hard to say how big the improvement will really be.
Other than that, I can only think of maybe using a faster runtime engine, such as Bun.

I implemented one with go. Currently, cli is faster than the Current package。Later, I will improve a version of WebAssembly 🥰
👉 markthree/go-get-folder-size

I tested that wasm implemented with go cannot call the io api 😂 After investigation, it is found that esbuild is also a subprocess call 😂 Go's wasm seems to be for the browser at the beginning 😵 It seems that for go users, it can only be compiled into binary executable files 🥵

All right, my node version is too high 😂

The wasm of go can be run 🫣

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

3 participants