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

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



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.)

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.

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.


-- 

Michael G Schwern                                           schwern@pobox.com
                    http://www.pobox.com/~schwern
     /(?:(?:(1)[.-]?)?\(?(\d{3})\)?[.-]?)?(\d{3})[.-]?(\d{4})(x\d+)?/i


Follow-Ups from:
Nick Ing-Simmons <nick@ing-simmons.net>
Ilya Zakharevich <ilya@math.ohio-state.edu>
References to:
Nick Ing-Simmons <nick@ing-simmons.net>

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