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

Improve file serving efficiency by streaming file #13

Open
SelinJodhani opened this issue Mar 16, 2024 · 0 comments · May be fixed by #14
Open

Improve file serving efficiency by streaming file #13

SelinJodhani opened this issue Mar 16, 2024 · 0 comments · May be fixed by #14

Comments

@SelinJodhani
Copy link

Issue

While dealing with large files, using ioutil.ReadAll() can lead to memory exhaustion due to reading the entire file into memory at once. This approach may not be suitable for files that exceed the available memory capacity, resulting in performance degradation or even program crashes.

start := time.Now()
b, err := ioutil.ReadAll(f)
fmt.Println("since: ", time.Since(start))

it took since: 16.911474529s time to load 5gb file into memory.

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

Successfully merging a pull request may close this issue.

1 participant