On Thu, Feb 03, 2000 at 03:06:48PM -0500, Joshua Pritikin wrote:
> On Thu, Feb 03, 2000 at 02:38:27PM -0500, [EMAIL PROTECTED] wrote:
> > in Event.pm have stub subs like this which only load the real one and
> > overload the sub's typeglob.
> >
> > sub Event::io {
> >
> > require 'Event/io.pm' ;
> >
> > *Event::io = \&Event::io::new ;
> >
> > goto &Event::io ;
> > }
> >
> > how crazy/workable is that?
>
> The idea is to avoid adding to the optree. io.pm isn't very long to
> begin with so doing something like this is just going to erode an
> already dubious savings of memory.
>
> Graham, feel free to correct me. :-)
I think you are right. When Event was all in perl there was some,
albeit small, savings by using the AUTOLOAD approach. Now
that most of Event is in XS and the watcher base class there is
very little saving.
$ wc -l lib/Event/*pm
133 lib/Event/MakeMaker.pm
113 lib/Event/Watcher.pm
32 lib/Event/idle.pm
70 lib/Event/inactivity.pm
21 lib/Event/io.pm
58 lib/Event/msg.pm
64 lib/Event/semaphore.pm
22 lib/Event/signal.pm
51 lib/Event/timer.pm
20 lib/Event/var.pm
584 total
And in the style of TomC :-)
$ perl -MEvent -e 'require Event::Watcher; system("ps l $$"); require "Event/$_.pm"
for (qw(idle inactivity io semaphore signal timer var)); system("ps l $$");'
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
000 1002 2155 2132 9 0 2880 1636 wait4 S pts/5 0:00 perl -MEvent -e
require Event::Watcher
In string, @perl now must be written as \@perl at
/usr/lib/perl5/site_perl/5.005/i586-linux/Event/semaphore.pm line 1, near "SysV
semaphores are not implemented yet. Send email to perl-loop@perl"
BEGIN not safe after errors--compilation aborted at
/usr/lib/perl5/site_perl/5.005/i586-linux/Event/semaphore.pm line 5.
Whoops, remove msg & semaphore
$ perl -MEvent -e 'require Event::Watcher; system("ps l $$"); require "Event/$_.pm"
for (qw(idle inactivity io signal timer var)); system("ps l $$");'
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
000 1002 2157 2132 9 0 2880 1636 wait4 S pts/5 0:00 perl -MEvent -e
require Event::Watcher
F UID PID PPID PRI NI VSZ RSS WCHAN STAT TTY TIME COMMAND
000 1002 2157 2132 15 0 2940 1696 wait4 S pts/5 0:00 perl -MEvent -e
require Event::Watcher
is 60K really worth it.
I would say just add requires for the standard Event classes into Event.pm
Graham.