Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

optimization:ReverseChunks::next,LinesChunkBuffer::fill andBytesChunkBuffer::fill intail#9667

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
fereidani wants to merge3 commits intouutils:main
base:main
Choose a base branch
Loading
fromfereidani:main

Conversation

@fereidani
Copy link

Hi,
First of all, I'm really happy that this project came together!
Here are a few improvements I identified and implemented:

  • ForReverseChunks::next, the original implementation allocated a new buffer on every call tonext(), which was quite expensive. I changed it to use a preallocatedVec<u8> that is zero-filled on each iteration whenself.block_idx > 0.

  • a same optimization was applied toBytesChunkBuffer::fill andLinesChunkBuffer::fill. In the previous version, the linechunk = self.chunks.pop_front().unwrap(); dropped a perfectly reusableBox on every loop iteration. I removed the unnecessarychunk.clone(), transferred ownership of the existing value back into the chunks container, and switched to usingOption<Box<Chunk>>. This allows us to reuse the allocation when the first chunk is removed, eliminates the need for new allocations in most cases.

Let me know if you'd like to discuss any of these in more detail!

@github-actions
Copy link

GNU testsuite comparison:

Skipping an intermittent issue tests/tail/overlay-headers (passes in this run but fails in the 'main' branch)

@sylvestre
Copy link
Contributor

thanks
Could you please write a benchmark like in src/uu//benches/
(in a different PR)

did you run hyperfine with your version, the previous and the gnu impl to compare the results?
thanks

@fereidani
Copy link
Author

@sylvestre Sure I will send the PR.
No but I did some micro benchmarking on the functions, I will run the hyperfine and will report back.
Thank you for your response and reviewing this PR.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@fereidani@sylvestre

[8]ページ先頭

©2009-2025 Movatter.jp