Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling

Re: For - Loop construct 'cheaper' than local variable?

by Brovnik (Hermit)
on Sep 30, 2001 at 02:44 UTC ( #115681=note: print w/replies, xml ) Need Help??

in reply to For - Loop construct 'cheaper' than local variable?
in thread One-shot code critique

You really shouldn't be worryomg about use of reseources at this level.

Focus on good style, readability, ease of coding, major performance issues, and all that other good stuff.

A decent compiler should optimise this sort of construct down to almost nothing (at most a single extra test), which will not be noticeable in the overall performance unless it is in the inside of a very tight loop.

Perl already does some interesting tricks, such as removing if statements from the code and replacing it with and/or, so trying to second guess what the byte code looks like is a waste of time.

The gain you will get in readability and hence reuse, ability to maintain should outweigh any effect in the code.

  • Comment on Re: For - Loop construct 'cheaper' than local variable?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://115681]
[stevieb]: Torturing one of my dev RPis to turn four 5v stepper motors at the same time (via Parallel:: ForkManager for 50k degrees (a whole lot of full turns!). Let's see if it burns out or not.
[stevieb]: My GPIO expander chips should arrive tomorrow, but I think I'll throw a shift register against them and see if all six I have will turn at once. Amps are near the breaking point, but I want to know max sustainable V and I output.

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2018-03-22 22:16 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (286 votes). Check out past polls.