http://www.perlmonks.org?node_id=526499


in reply to Efficient code.

murugu,

To put it differently, you don't know, your friend doesn't know and your friend's boss doesn't know. You're taking a guess. And you're asking us to take a guess.

Why don't you code up both approaches and use something like Devel::Dprof to find out for sure which is faster?

Personally, I'd use List::Compare to do it and be done with it. (Make sure you look at the unsorted option if you do use List::Compare.) Later, if it was judged to be "too slow" then I'd worry about making it faster.

Cheers,

Brent

-- Yeah, I'm a Delt.