Benchmark Test Correction for boost::sort #83
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In reviewing the benchmark_numbers.cpp file, I noticed that the functions Generator_sorted_middle and Generator_reversed_sorted_middle have identical definitions. Additionally, certain parts of these functions' code lack coherence. I am proposing a resolution for these issues.
Problems Identified:
The method Generator_reversed_sorted_middle currently sorts the elements after swapping them, contradicting the intention of a reversed sort ( l. 246 - 247 ). In Generator_reversed_sorted_middle the swapping also happens, with no use afterwards ( l. 188 - 189).
The Generator_sorted_middle and Generator_reversed_sorted_middle functions generate more elements compared to other methods. For instance, the Generator_sorted_middle function generates 100200000 elements when running sorted + 0.1% end, while other functions generate only 100100000. This unequal element generation inhibits fair comparison between different algorithms.
The algorithm execution leads to an out of bound access at lines 199 and 257.
Proposed Solution:
I have made adjustments to address these issues. The changes lead to more consistent and accurate benchmark tests between sorting algorithms. I look forward to feedback on my proposed revisions.