in reply to Perl keyword like the C/C++ keyword 'inline'
Maybe codefilters (see Filter::Simple) were meant to replace them, but I don't recommend their use.
Anyway perl knows the term "inlining" for subs but they are restricted to constant return values only (see Constant Functions)
An other approach would be dynamic code generation with a template-system and eval.
One more could be to use labels and gotos to avoid the function overhead. (you can also goto directly into a functionbody, but you have to take care by your self how to get back to the caller ...)
Anyway perl is not meant for these kinds of optimizations, the original concept was to delegate time critical tasks to embedded c code (see perlxs)
Cheers Rolf
UPDATE:added some links
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Perl keyword like the C/C++ keyword 'inline'
by sadarax (Sexton) on Sep 29, 2009 at 08:47 UTC |