Re: Need help passing arrays by reference pls.

From: ko (kuujinbo_at_hotmail.com)
Date: 02/08/04

  • Next message: ko: "Re: Time with Epoch earlier than 1970 question"
    Date: Sun, 08 Feb 2004 15:51:30 +0900
    
    

    Ben Morrow wrote:

    [snip]

    > A tool I like for answering this sort of question is B::Graph, which
    > produces a graph of the optree. It seems that
    >
    > print "a", "b";
    >
    > becomes
    >
    > nextstate -> pushmark -> const -> const -> print
    >
    > (nextstate starts a new statement. pushmark makes a mark in the Perl
    > stack to show where the arguments for the print begin. The consts push
    > items onto the stack, the print takes them off down to the mark and
    > prints them) whereas
    >
    > print "a" . "b";
    >
    > becomes
    >
    > nextstate -> pushmark -> const -> print
    >
    > ie. perl will perform the concatenation at compile time, and thus it
    > must be more efficient. However,
    >
    > print "a", $x;
    >
    > becomes
    >
    > nextstate -> pushmark -> const -> padsv -> print
    >
    > as before (padsv gets the value of the variable and pushes it onto the
    > stack) whereas
    >
    > print "a" . $x;
    >
    > becomes
    >
    > nextstate -> pushmark -> const -> padsv -> concat -> print
    >
    > ie. the concatenation is done as a separate step before the print, so
    > it may well be slower (this depends on whether printing several items
    > as opposed to one is slower or faster than concatenating them).
    >
    > Certainly it is not true that they are the same

    [snip]

    Perl's internals are over my head, but thank you for providing a simple,
    concise explanation that makes sense. Have never used any of the B
    modules and tried to play around with B::Graph, but couldn't figure out
    how to get output like yours :( . But there's a link at the bottom of
    the documentation, so I'll look at that and at perlguts.

    keith


  • Next message: ko: "Re: Time with Epoch earlier than 1970 question"

    Relevant Pages

    • RE: Basic types: objects or not?
      ... Mark R. Dawson wrote: ... > types of areas of memory allocated to a process), the stack also stores ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: Spade a spade
      ... >Mark wrote: ... > by bankruptcy laws are from homeowners who find themselves unable, ... People in my community wanted greenspace. ...
      (soc.men)
    • Re: More ALERTS! For Rich Shewmaker, GROW UP
      ... >> the snip, of course). ... > And YOU have done so much selective snipping in this that I cannot tell ... >>> of leaving in the part that you are responding to, you snip it, usually ... >> That is EXACTLY what you just did, with the thread you botched up of Mark ...
      (misc.health.alternative)
    • Re: Meg Munn chunters on...
      ... >Mark wrote: ... This is how you understand me to be in regards to house and home? ... > SELL SELL SELL ...
      (soc.men)
    • Re: Statement on Schildt submitted to wikipedia today
      ... ie. not a stack in the sense of contiguous memory ... how many activation records will need to exist at any one time for any ... It is a mark of incompetence to speak of globals at fixed locations. ...
      (comp.lang.c)