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::blocking_call perf #184

Closed
ikopylov opened this issue Aug 26, 2022 · 1 comment · Fixed by #216
Closed

Improve File::blocking_call perf #184

ikopylov opened this issue Aug 26, 2022 · 1 comment · Fixed by #216
Assignees
Labels
enhancement New feature or request performance

Comments

@ikopylov
Copy link
Member

ikopylov commented Aug 26, 2022

Function uses tokio::task::spawn_blocking which reduce overall performance by ~20%

https://github.com/qoollo/pearl/blob/master/src/blob/file.rs#L207

@ikopylov
Copy link
Member Author

We should check block_in_place function: https://docs.rs/tokio/0.2.22/tokio/task/fn.block_in_place.html

Probably, there should be a compromise strategy (should be verified by performance tests):
if data size is less than 4Kb, then call blocking function directly,
if data size from 4Kb to 64Kb, then use block_in_place,
if data size >= 64Kb, then use spawn_blocking

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request performance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants