[ANN] 3 different Combinations

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ANN] 3 different Combinations

HwaJong Oh
Hi,

I've brushed up old Combinations to performance enhancements.

You can load it like:

ConfigurationOfSciSmalltalk project lastVersion load.



You may as why 3?
The is to compare them and collect some concensous. They are:
BadOldCombinations, NewBetterCombinationsGoodAtRandomAccess, NewBetterCombinationsGoodAtSequentialAccess.

I've named them a little longer but easier to distinguish. Check the class comments of the 3 and you will know the difference.

I'll post a benchmarking code below, so you can see how they differ.

seqWork := [:class| [ (class of: (1to:20) length: 10) asArray ] timeToRun]. 

t1 := seqWork value: BadOldCombinations.
t2 := seqWork value: NewBetterCombinationsGoodAtRandomAccess.
t3 := seqWork value: NewBetterCombinationsGoodAtSequentialAccess.


randWork := [:class| [ |c| c:= class of: (1to:20) length: 10.
1000 timesRepeat: [c atRandom] ] timeToRun ].

t4 := randWork value: BadOldCombinations.
t5 := randWork value: NewBetterCombinationsGoodAtRandomAccess.
t6 := randWork value: NewBetterCombinationsGoodAtSequentialAccess.


HwaJong Oh

--
You received this message because you are subscribed to the Google Groups "SciSmalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.