Skip to content

Conversation

AsakuraMizu
Copy link
Contributor

The default read_to_end implementation is so slow that it has become a major bottleneck when loading even medium sized files (e.g. 1MiB). This PR optimizes it by adodpting default_read_to_end from std::io.

Moreover, implementers may utilize "default_read_to_end" to pass an optional size_hint.

Copy link
Member

@equation314 equation314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR has many differences from the code in https://github.com/rust-lang/rust/blob/30f168ef811aec63124eac677e14699baa9​​395bd/library/std/src/io/mod.rs#L409.

Could you try to minimize the differences?

@AsakuraMizu
Copy link
Contributor Author

This PR has many differences from the code in https://github.com/rust-lang/rust/blob/30f168ef811aec63124eac677e14699baa9​​395bd/library/std/src/io/mod.rs#L409.

Could you try to minimize the differences?

Oh I didn't notice that BorrowedBuf is available in core and tried to mimic its behaviour. Let me fix it.

@AsakuraMizu AsakuraMizu requested a review from equation314 March 9, 2025 08:22
@equation314 equation314 merged commit 930637b into arceos-org:main Mar 10, 2025
5 checks passed
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 this pull request may close these issues.

2 participants