-
Notifications
You must be signed in to change notification settings - Fork 375
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
Comparing array subset checks #125
base: main
Are you sure you want to change the base?
Conversation
Your code above is massively dependent to used sample arrays. Using this samples ARRAY1 = [*(400..500)].freeze
ARRAY2 = [*(1..500)].freeze will change your results completely. I would prefer to use a more real-world sample for the test to avoid misleadings… |
Maybe |
@mblumtritt What you suggest as a real world example? It would be nice if I generate a random-filled array of integers and let it static in the test or something like that? @Arcovion Nice, I'll add both. Thank you guys. (: |
@gabteles Do you mean something like this? ARRAY1 = [*(400..500)].shuffle.freeze
ARRAY2 = [*(1..500)].shuffle.freeze Then we have to other problem: how is the weight between the set and the subset 🤔 Or do you prefer a complete random set to compare?… In "real world" I would check my chances to be faster with a complete different algorithm. For sample what about sorting first descending? This might be faster if both sets already nearly sorted… I'm unsure to give a "general advice" for this subset problem. In "real world" it always depends… ;) |
@mblumtritt Yeah, I agree that the weight between set/subset is a big problem to benchmark. I'm not sure how to handle it. Before I meant something like this:
Using it statically grants that we won't have performance improved/degraded by randomness effect of shuffle or rand in runtime. But it also suffers of the weight problem. |
No description provided.