<div dir="ltr">really interesting.<br>but it reveals slower but it was because of Set operations. To be consistent with other method, I used an array.<br><br>subsets6<br>&nbsp; | subsetsSize subsets workArray |<br>&nbsp; workArray := self asArray.<br>
&nbsp; subsetsSize := 2 raisedTo: self size.<br>&nbsp; subsets := Array new: subsetsSize.<br>&nbsp; 1 to: subsetsSize do: [:sift |<br>&nbsp;&nbsp;&nbsp;&nbsp; subsets at: sift put:<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (workArray selectIntegerMask: sift into: (Set new: sift highBit) )].<br>
&nbsp; ^subsets <br><br>Putting asSet as the end is very expensive when the collection is big<br><br><br>results:<br><br>set := (1 to: 15) asSet.<br>[ set subsets &quot;first sift&quot; ] timeToRun .&quot; 2484&quot;<br>[ set subsets4&nbsp; &quot;combinationsSize:do:&quot;] timeToRun. &quot; 1598&quot;<br>
[ set subsets5&nbsp; &quot;Zulk&quot;] timeToRun.&quot; 12493&quot;&nbsp;&nbsp;&nbsp; &quot;I think he uses Set for the subset&quot;<br>[ set subsets6&nbsp; &quot;optimized sift] timeToRun. &quot; 1436&quot;&nbsp;&nbsp; &quot;Winner :) &quot;<br><br>Thats was instructive, especially the way you deal with bit. Nice also how you removed the reverse(s).<br>
<br>Cédrick<br><br><br><br><br></div>