Skip to content

Fix RemoveDuplicateElementsBenchmark, because the results were wrong#1128

Closed
jakubsuchybio wants to merge 1 commit intoCodeMazeBlog:mainfrom
jakubsuchybio:fix-remove-duplicate-elements-benchmark
Closed

Fix RemoveDuplicateElementsBenchmark, because the results were wrong#1128
jakubsuchybio wants to merge 1 commit intoCodeMazeBlog:mainfrom
jakubsuchybio:fix-remove-duplicate-elements-benchmark

Conversation

@jakubsuchybio
Copy link

@jakubsuchybio jakubsuchybio commented May 26, 2023

  • Upgrade to net7
  • Switch from comparing speed on strings to comparing on ints
  • Rewrite the 200 element array with 3 many duplicate strings to parametrized setup with N=100,10000 and Duplicates calculated by percentages 0,25,50,100

Because previous benchmark results were scewed towards O(n^2) algo as faster than O(n) algo, which is obviously bad result. Also benchmarking on comparing strings in the array might scew the results even further

Also wrote a comment to your article which is definitely wrong too, but can't edit that.
https://code-maze.com/csharp-array-remove-duplicates/

- Switch from comparing speed on strings to comparing on ints
- Rewrite the 200 element array with 3 many duplicate strings to parametrized setup with N=100,10000 and Duplicates calculated by percentages 0,25,50,100

Because previous benchmark results were scewed towards O(n^2) algo as faster than O(n) algo, which is obviously bad result. Also benchmarking on comparing strings in the array might scew the results even further
@jakubsuchybio
Copy link
Author

Ehm... Why didn't it get merged?

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.

2 participants