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

Optimized set type random performance and cleanup list code #1406

Closed
wants to merge 1 commit into from

Conversation

artikell
Copy link
Contributor

@artikell artikell commented Dec 8, 2024

There are currently two random methods, and the random+lseek method has poor performance.

Test result(test_listpackBenchRandom):
lpNextRandom, List size: 10000, average 58 usec
lpSeek, List size: 10000, average 86 usec

Copy link

codecov bot commented Dec 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.82%. Comparing base (6df376d) to head (2963107).
Report is 2 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1406      +/-   ##
============================================
- Coverage     70.82%   70.82%   -0.01%     
============================================
  Files           118      118              
  Lines         63561    63555       -6     
============================================
- Hits          45020    45014       -6     
  Misses        18541    18541              
Files with missing lines Coverage Δ
src/t_list.c 92.93% <100.00%> (+0.09%) ⬆️
src/t_set.c 97.84% <100.00%> (-0.01%) ⬇️

... and 14 files with indirect coverage changes

Copy link
Member

@enjoy-binbin enjoy-binbin left a comment

Choose a reason for hiding this comment

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

LGTM.

for (size_t i = 0; i < count; i++) {
unsigned int j = 0;
// unsigned int len = 0; /* initialize to silence warning */
// long long llele = 0; /* initialize to silence warning */
Copy link
Contributor

Choose a reason for hiding this comment

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

Unused stuff left from debugging?

@artikell
Copy link
Contributor Author

I'm sorry for this MR.

After repeated testing, I found that this was a negative optimization, and the previous conclusion was that there was a problem with the time count.

lpNextRandom, List size: 1, total 10208 usec
lpSeek, List size: 1, total 11910 usec
lpNextRandom, List size: 10, total 80714 usec
lpSeek, List size: 10, total 44500 usec
lpNextRandom, List size: 100, total 544099 usec
lpSeek, List size: 100, total 170914 usec

Here is a new result, lpSeek performs better, which also implies that lpNextRandom may be an optimizable function.

I decided to close this MR. Follow up and think about how to optimize.

@artikell artikell closed this Dec 15, 2024
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.

3 participants