Added performance test for allSubsets in CTOrderedSetTest#5
Added performance test for allSubsets in CTOrderedSetTest#5jordanmontt merged 3 commits intopharo-containers:masterfrom
Conversation
|
@jordanmontt please look for this one |
|
|
||
| time := [ set allSubsets ] timeToRun. | ||
| self assert: set allSubsets size equals: (1 bitShift: 10) - 2. "1022 subsets" | ||
| self assert: time < 1 second description: 'Should complete within 1 second for size 10'. |
There was a problem hiding this comment.
Does this fail used to fail before?
|
Interesting optimization. But, to be sure that it is faster we need to don some benchmarks. In Pharo you can use the |
The speedup reflects the percentage improvement. Let me know if further adjustments are needed! |
|
Great! Sorry for taking time to merge this |

Issue #3 fixed
This PR optimizes the allSubsets method in CTOrderedSet by replacing the inefficient combinations-based implementation with a bitmask-based approach. Additionally, it introduces a new performance test, testAllSubsetsPerformance, in CTOrderedSetTest to ensure the method generates the correct number of subsets (1022 for a set of size 10) and completes within 1 second.
CTOrderedSet.class.st
Before
After
CTOrderedSetTest.class.st
Added
@jordanmontt