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

fix: resolve cpu load issue of prepare_uninitialized_buffer #26

Merged

Conversation

quake
Copy link
Contributor

@quake quake commented Jan 6, 2021

After doing some basic profiling, I found that a lot of CPU was spent on memset, and traced the code to find that it was caused by not implementing the prepare_uninitialized_buffer method

below is the bench result comparison

After counting 10 cycles, estimated total time spent on task "10mb_benchmark_with_secio" is 3.0800651s
task name: 10mb_benchmark_with_secio
cycles: 100
total cost: 3.019923503s
average: 30.199235ms
median: 30.015518ms
max: 42.400898ms
min: 28.272243ms

v.s

After counting 10 cycles, estimated total time spent on task "10mb_benchmark_with_secio" is 1.707217s
task name: 10mb_benchmark_with_secio
cycles: 100
total cost: 1.75304821s
average: 17.530482ms
median: 17.24187ms
max: 35.465816ms
min: 16.76556ms

Copy link
Owner

@driftluo driftluo left a comment

Choose a reason for hiding this comment

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

Yes, I did not notice this implementation. In our implementation, it is guaranteed that we will not read any data in the undefined buffer. This guarantee can be skipped directly here.

@driftluo driftluo merged commit 6b15527 into driftluo:master Jan 7, 2021
@driftluo driftluo deleted the quake/prepare_uninitialized_buffer branch January 7, 2021 02:15
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.

None yet

2 participants