-1

I know non-constant subroutines usually will not be inlined, since they can be redefined on the fly. However, I have code where inlined subroutines would actually offer a small but non-trivial optimization; but I don't want to unroll them myself since it would make the code much harder to read.

Is there some way to make Perl inline these methods, a way to indicate that the subroutine will not be modified at runtime and I want the interpreter to inline during the preprocessing phase?

dsollen
  • 6,046
  • 6
  • 43
  • 84

1 Answers1

1

Constants can be folded, but Perl subs are never inlined. Practically, they can't be. macro and Macro attempt to provide inlinable subs, but I don't know how reliable they are. You will definitely find limitations.

ikegami
  • 367,544
  • 15
  • 269
  • 518