Paul Johnson wrote: > On Fri, Oct 13, 2006 at 01:04:01AM +1300, Robin Sheat wrote: > >>Hmm, when i started looking on the net, that was one of the first things that >>came up. Also this: >>http://www-128.ibm.com/developerworks/library/l-optperl.html >>They're helpful, but unfortunately not largely applicable. Although, I may >>need to read them closer. > > I'm not convinced by this one. Some of the advice is good, but some seems > just wrong. > > For example: > > - I'm not convinced that anyone is going to be able to measure any increase > in speed by using "string" instead of 'string'.
They should both take about the same time to compile as there is no variable interpolation involved. See the "Gory details of parsing quoted constructs" section of: perldoc perlop > - I don't think that using map in void context instead of a for loop will > lead to any speeed increase. In earlier perls it will lead to a slowdown. And the fact that he uses {} with map which has the overhead of creating lexical scope in the block. > - The loops working on keys(%hash) should probably all be working on > values(%hash) which would allow the loop body to be simplified. > > - Trying to use perlcc is generally a bad idea, and the code has been pulled > from the 5.10 release. He wouldn't have known about perlcc going away at > the time this was written, but using perlcc has been actively discouraged > for a long time since it never worked well, and didn't even seem to lead to > speed improvements when it did work. > > - I don't agree with turning off warnings and strict in production. If > something goes wrong in production I want to know about it. > > But as I say, there is also some good advice there too. You missed one glaring error: <QUOTE> By the way, in this example, an even quicker way of producing a string that repeats the alphabet 999,999 times would be to use: $concat = 999999 x 'abcdefghijklmnopqrstuvwxyz'; </QUOTE> where he has the operands in the wrong order, it should be: $concat = 'abcdefghijklmnopqrstuvwxyz' x 999999; John -- Perl isn't a toolbox, but a small machine shop where you can special-order certain sorts of tools at low cost and in short order. -- Larry Wall -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>