[% setvar title Replace Exporter by a better scaling mechanism %]
To see what is currently happening visit http://www.perl6.org/
Replace Exporter by a better scaling mechanism
Maintainer: Ilya Zakharevich <ilya@math.ohio-state.edu> Date: 15 Sep 2000 Mailing List: perl6-stdlib@perl.org Number: 233 Version: 1 Status: Developing
This RFC proposes a minimal efficient well-scaling mechanism for exporting. Only export of subroutines and tags are supported by this mechanism.
Exporter gives an enormous efficiency hit for modules with a large
list of exportable symbols (but which are very small nevertheless, say,
because everything is autoloaded). It is supposed to be optimized for
speed, with a lot of caching and keeping things close at hand. However,
all these actions are in fact only slowing things down, since they create
a lot of code to compile, and a lot of data structures to maintain.
In many cases the Exporter-support data creates up to 90% of memory overhead of the module (so may be supposed to provide a similar fraction of the load time overhead).
Lessons learned:
This provides a crucial advantage in the memory footprint, and may provide speed advantages (maybe even if the module is imported from many times).
This string may contain items of two kinds: symbols, and tag lists of the
form ":tag[ :subtag1 :subtag2 symbol1 symbol2 ]". If symbols appears
inside a tag, it need not be repeated again. The default exporting list
should be provided the same as the list for the :DEFAULT tag.
' :DEFAULT[:micro :mini additional_f(\%)] :micro[ func1($$) ]
:mini[ func2($) ] :extra[ func3() ] func4($) '
Having the prototypes in this list may be useful, since the same list may be used by the compile-time action of autoloading, reducing the overhead yet more. (See RFC on flexible autoloading.)
use export q( func1($$) func2($) ); # No default
use export sub { local $/; my $l = <DATA>; eval 'use export $l'; $l };
...
__DATA__
func1($$)
func2($)
This is desirable since the subroutine may be autoloaded (either explicitly, or as above), thus reducing yet more the overhead of import-less
use Module ();
None.
Straightforward.
None.