Re: local vs. my (was Re: code line of the day)
Chris Dolan <[email protected]> Sat, 9 Sep 2006 13:56:09 -0500
| Newsgroups | gmane.comp.lang.perl.fun |
|---|---|
| Message-ID | <[email protected]> |
On Sep 9, 2006, at 3:12 AM, A. Pagaltzis wrote: > * Chris Dolan <[email protected]> [2006-09-09 03:55]: >>> Works the same. I often use `local $_` in tiny functions that >>> mangle just a single value. Matter of taste/style. >> >> Ahh, I see -- cargo cult. ;-) > > Err, what? I chose that style for myself. I didn’t pick it up > from anyone else and certainly not unthinkingly. I didn't mean that to be insulting -- I was just teasing. In fact I usually respect your contributions a lot, so I was curious why your style was different from mine and if there was a reason why yours might be better. >> I just benchmarked the two versions, and "my" wins by a wide >> margin: >> >> % perl test.pl >> Rate local my >> local 467290/s -- -33% >> my 699301/s 50% -- > > I dunno if that was supposed to be an argument, but I couldn’t > care less. I hope I don’t have to explain why as well. That was for my curiosity and to convince me, not to convince you. That's why I changed the subject line in the message. I apologize for my less-than-clear motives. Chris -- Chris Dolan, Software Developer, Clotho Advanced Media Inc. 608-294-7900, fax 294-7025, 1435 E Main St, Madison WI 53703 vCard: http://www.chrisdolan.net/ChrisDolan.vcf Clotho Advanced Media, Inc. - Creators of MediaLandscape Software (http://www.media-landscape.com/) and partners in the revolutionary Croquet project (http://www.opencroquet.org/)