Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Combinations of lists, etc (updated)

by haukex (Archbishop)
on Oct 04, 2019 at 12:17 UTC ( [id://11107039]=note: print w/replies, xml ) Need Help??


in reply to Combinations of lists to a hash

I'm not wanting the overhead of a module, please.

As opposed to the overhead of "hours of messing around with various attempts at this"? ;-) Anyway, you might be interested in the code in my post here.

Update: I used this as the motivation to release Algorithm::Odometer::Tiny!

Replies are listed 'Best First'.
Re^2: Combinations of lists, etc (updated)
by tel2 (Pilgrim) on Oct 07, 2019 at 02:55 UTC
    My hours of messing around was a secondary consideration in this case, because I thought loading a module would be slightly less efficient than in-line code, especially for this regularly hit situation (i.e. every page load on my website).

    I'm deeply honoured and even impressed that you wrote that module as a result of my problem, haukex.  Thank you.  Don't forget to include me in the credits.   My name is spelt: "Some Kiwi Novice @ PerlMonks".

      My hours of messing around was a secondary consideration in this case, because I thought loading a module would be slightly less efficient than in-line code, especially for this regularly hit situation (i.e. every page load on my website).

      Yes, the code could certainly be inlined, hence the ::Tiny. Although depending on how many items you're generating, a speed boost in generating combinations by a factor of roughly 10x can be achieved with XS modules such as Set::Product::XS.

      Don't forget to include me in the credits. My name is spelt: "Some Kiwi Novice @ PerlMonks".

      Done :-)

        The number of items being generated is pretty low - usually a hundred or less.  For that I thought the loading of a module would be a relatively high overhead for a job which I hoped could be done with a small amount of non-module code, (and the answers have confirmed it's just a small amount of code).  Thanks for the Set::Product::XS tip.

        And thanks for the credits, haukex.  At last I've reached a level of fame in the Perl world.  Good to meet another person who knows how to take humour seriously.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-25 06:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found