Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: IN-style operator for set of possible values

by BrowserUk (Patriarch)
on Mar 16, 2012 at 02:59 UTC ( [id://959904]=note: print w/replies, xml ) Need Help??


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% --

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

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

    And this is probably one of several reasons that Damian Conway places Quantum::Superpositions in the "Damian modules you shouldn't use in production because their purpose is to explore and prototype future core language features" category in his Categorized Damian Modules list.

    The performance sucks, but, at least according to TheDamian, it was never intended to be used in production.


    Dave

      Indeed. A note to that effect in the POD would prevent the unwary being caught out though.

Re^3: IN-style operator for set of possible values
by kejohm (Hermit) on Mar 16, 2012 at 04:10 UTC

    Yeah, you're right. It was more in the spirit of TIMTOWTDI.

    That's like choosing the Large Hadron Collider to pop your corn...

    mmm, quantum popcorn :)

      mmm, quantum popcorn :)

      You haven't lived until you've tried quantum popcorn. I like mine seasoned with flakes of 5-dimensional branes.

      perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://959904]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others admiring the Monastery: (5)
As of 2024-04-19 07:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found