in reply to Re: When should I use map, for?
in thread When should I use map, for?
I'm aware that the extra logical branch adds a small amount of complexity; However, the || short-circuts, so if a substitute is made, the '1' isn't evalated. Also, the '1' doesn't take a lot of time to evaluate. It's also needed to accomplish the substitution in that way. Even in your results the for is notably faster -- so your point seems moot anyhow.
When is map more appropriate (faster) than for, and vice-versa?
The Eightfold Path: 'use warnings;', 'use strict;', 'use diagnostics;', perltidy, CGI or CGI::Simple, try the CPAN first, big modules and small scripts, test first.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: When should I use map, for?
by fishbot_v2 (Chaplain) on May 19, 2005 at 21:18 UTC | |
by shemp (Deacon) on May 19, 2005 at 22:49 UTC | |
by fishbot_v2 (Chaplain) on May 19, 2005 at 22:58 UTC | |
by shemp (Deacon) on May 20, 2005 at 17:03 UTC |