in reply to Efficiency Question

In your example, $object already is a reference that's been blessed into a class. That's all an object is—a blessed reference. Passing in a reference to that reference doesn't gain you anything.

Replies are listed 'Best First'.
Re^2: Efficiency Question
by kennethk (Abbot) on Mar 25, 2009 at 19:28 UTC
    To be pedantic, you will take a hit from passing the object references since it will involve an extra ref/deref step. Of course, if that hit actually matters in any way/shape/form, either you or your code have some serious issues.
      OTOH, in addition to the insignificant performance hit, there may be a very significant maintenance hit. A future maintainer (maybe even the original author of the code!) may take a look at the superfluous ref/deref process, think "What the...?!?", and start looking through a ton of code for some clue as to why such a non-standard and round-about approach was used.

      The considerate thing to do is to avoid setting someone else (or, again, maybe even yourself) up for such a wild-goose chase.

        1. Write wildly confusing code.
        2. Get listed on DWTF
        3. Profit!
        --
        No matter how great and destructive your problems may seem now, remember, you've probably only seen the tip of them. [1]