in reply to Re: Optimizing away calls to functions defined in eval
in thread Optimizing away calls to functions defined in eval

I've tried the BEGIN idea and it's not working. Could it be because I've got the evals in a function that is found through inheritance?

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

  • Comment on Re: Re: Optimizing away calls to functions defined in eval

Replies are listed 'Best First'.
Re: Re: Re: Optimizing away calls to functions defined in eval
by perrin (Chancellor) on Oct 16, 2001 at 17:53 UTC
    By "not working", do you mean that the memory doesn't seem to be shared? If you're loading the module in your startup.pl and defining methods in a BEGIN, it should work. Or are you talking about something totally different?
      I've got a slightly more complex structure than that.

      I've got my main script. It's brings in Foo. Foo inherits from Bar. Within Bar lives define_attributes(), which creates the attributes and accessor functions. Foo calls Foo->define_attributes() with the attributes it wants to define.

      Now, everything works just fine (without things like BEGIN, etc). I wanted to find out if there was a way I could optimize away the function calls while still being able to define them on-the-fly.

      ------
      We are the carpenters and bricklayers of the Information Age.

      Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.

        I think we're going in circles. My comment about BEGIN blocks actually had nothing to do with optimizing function calls; it was about optimizing shared memory under mod_perl.

        As far as optimizing function calls goes, my original assertion still stands: eval() works the same way as any other kind of compiling and should perform the same kinds of optimizations. What makes you think that it's not happening?