Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • A second class you should look at Auto-XS'ifying is constants.

    Something like sub { 1 } turns into dramatically faster XS.
    • That should be happening anyway, right? Perhaps only if you write sub () {1}.

      The next thing I might tackle is setters. However, since those come in a much wider variety than getters, it'll take some better matching tools than what we have now in B::Utils. Just look at the code of AutoXS::Accessor for a sample of what kind of cruft I produced.

      So as a yak shaving exercise, I'd like to write two routines: One that produces a pattern/condition structure for B::Util's opgrep() from an existing op tree and one th
      • sub () { 1 } gets you part of the way.

        But the XS version is even faster again.
      • I just wrote the code to produce opgrep patterns from op trees (I.e. B::OP objects). Expect B::Utils 0.05_06 on CPAN soonish.

        Oh, and there is a typo in my last comment. The second code snippet is missing a closing ]. Sorry about that.
  • This would be pretty awesome in something like Moose or Class::Accessor::Classy.

    I would rather see it work declaratively instead of scanning for candidates (that seems like a separate tool.)

    I'm also sort of envisioning an optimizing build process (which would eliminate any latency in compiling during development -- something that always bugs me about Inline.)
    • You're right, of course. The code is really two quite separate parts: The B-based scanner which identifies targets and the XS/ALIAS hack which instantiates a new "curried" alias to the XSUB accessor. It should be simple to let the user explicitly flag subs for replacement instead of scanning. (Though the preposterous namespace choice doesn't make sense any more then.)

      Actually, it would be even simpler to have a module and interface:

      use Class::Accessor::XS::I::Am::Sure::That::Namespace::Is::Taken
    • I just uploaded Class::XSAccessor [] to PAUSE. It contains the code to install the fast XS accessors into user packages. It also supports setters.