in reply to Re: IN-style operator for set of possible values
in thread IN-style operator for set of possible values
You can always rely on the power of quantum computing:
That's like choosing the Large Hadron Collider to pop your corn, just because it has a long and impressive name. It might get there eventually, but it takes an awful long time.
Below, Quantum::Superpositions::any() takes 15 whole seconds to do what List::MoreUtils::any() does in 0.1 second. (plain ol'grep is quicker still!)
Don't be overly impressed with the spiel, Q::S is just a bunch of (s-l-o-w) loops underneath:
@a=1..1000; cmpthese -1,{ a=>q[ my$n=0; for my $i (1..1000) { Quantum::Superpositions::any( +@a ) eq $i and ++$n } ], b=>q[ my$n=0; for my $i (1..1000) { List::MoreUtils::any{ $i eq $_ + } @a and ++$n } ], };; (warning: too few iterations for a reliable count) s/iter a b a 15.4 -- -99% b 0.103 14834% --
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: IN-style operator for set of possible values
by davido (Cardinal) on Mar 16, 2012 at 03:21 UTC | |
by BrowserUk (Patriarch) on Mar 16, 2012 at 04:11 UTC | |
|
Re^3: IN-style operator for set of possible values
by kejohm (Hermit) on Mar 16, 2012 at 04:10 UTC | |
by tobyink (Canon) on Mar 16, 2012 at 08:13 UTC |