[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Re: Class::Fields, a base/fields.pm rewrite



Michael G Schwern <schwern@pobox.com> writes:
>On Thu, Dec 30, 1999 at 06:58:03PM +0000, Nick Ing-Simmons wrote:
>> Michael G Schwern <schwern@pobox.com> writes:
>> >
>> >* base.pm was modified to use functions provided by Class::Fields and kids.
>> 
>> I am not sure I like that. I 'use base' in all the Tk modules just to get 
>> "compiler friendly" compile-time @ISA setting. I don't want a whole 
>> slew of other files loaded for %FIELDS stuff I don't use.
>
>AFAIK with regard to @ISA this:
>
>	package Bar;
>	use base qw(Foo);
>
>is pretty much equivalent to this:
>
>	package Bar;
>	BEGIN {
>		require Foo;
>		@Bar::ISA = qw(Foo);
>	}
>
>There's a little more going on, but that's about it.  No magic (there
>may be in the future, I dunno).  base.pm isn't really a pragma in the
>strict sense of the word, its just a bit of sugar (ignoring the whole
>fields thing, of course.)

Yes that is about it.

>
>base.pm already does all the %FIELDS stuff.  The only difference is
>that instead of going it inside fields.pm and base.pm it does it in
>seperate libraries.

Which involve fairly expensive file system search for the .pm files.
(It is particularly painful on non-caching file systems like Win32.)
But on reflection that only happens once per file so Tk's multiple
uses don't multiply the problem. So now I am only worried that the 
%FIELDS work is more in the new scheme - must take a look I guess.

>
>As far as efficiency goes, yes there is a slight drop off.  I've seen
>that my changes cause base.pm to take longer to initally load and use
>up about 100KB more memory, but the run-time is the same (which is to
>say, negligible).  Of course, I haven't done any optimizations yet.
>
>Given that Tk.pm uses over 4 megs of memory itself just to load and an
>appreciable amount of time to load, I don't think the change will
>effect Tk's performance at all.  If it turns out otherwise, give me
>some numbers and I'll see if I can slim things down.
-- 
Nick Ing-Simmons


References to:
Nick Ing-Simmons <nick@ing-simmons.net>
Michael G Schwern <schwern@pobox.com>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]