What you have shown is XS code compiled using the most inefficient, backwards-compatible mode. If you compile it with ... All those checks ... All those calls ... macros designed for use by XS are less efficient ...
So, what you are saying is, if every XS-dabbling programmer, became an XS expert and learnt all the rules and tricks and techniques; and then they all modified all of their modules and programs, then things would run faster.
Wouldn't it be nice if we had tools that took care of that?
And if a modern C compiler can't cope with a a few extra no-op {} scopes added by perl's macros, there's something wrong with it.
If C compilers were able to optimise away all that stuff, then wouldn't #define PERL_NO_GET_CONTEXT be unnecessary? An effective noop under optimisation?
Compile-time optimisers cannot optimise across compile unit boundaries. C compilers are beginning to do LTO, but at a very limited level.
If you used LLVM simply as an alternative C compiler, it couldn't do much more than modern C compilers do, but it is capable of doing so much more.
Show me some actual assembly of a function in pp_hot.c that's being significantly crippled by the design of perl's macros, and I'll start to take it seriously.
You could show me ...
But who decided what was "hot"? On the basis of tracing what code?
If the functions in pp_hot.c have come in for some special attention that has proven demonstratively worth that effort, isn't it possible that programs that use function outside of pp_hot.c might benefit if the functions they use came in for similar treatment?
And isn't it just possible that a radically different (un-C-like) alternative like LLVM might be able to make pp_hot.c type changes elsewhere, in an automated manner?
And maybe even find other changes that C compilers and programmers wouldn't even consider?
Other than that, everything you've talked about is wild speculation so far.
Agreed. Speculation based on some two years (on and off) of looking at what LLVM can, and is, doing, but still speculation. And clearly labeled as such.
And it will remain that way until someone tries it. (Aren't you in the least bit intrigued?)
In reply to Re^7: Perl 5 Optimizing Compiler, Part 4: LLVM Backend?
by BrowserUk
in thread Perl 5 Optimizing Compiler, Part 4: LLVM Backend?
by Will_the_Chill
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |