in reply to Re^7: Inline::C on Windows: how to improve performance of compiled code?
in thread Inline::C on Windows: how to improve performance of compiled code?
T'is unfortunate that almost every function that does anything useful needs to call at least one perl API
Indeed ... though it's also often the case that many functions that call the Perl API don't really need to.
Here's a simplistic example:
But the rendition that has been commented out won't work when PERL_NO_GET_CONTEXT is defined, whereas the other rendition will.
So there are possibilities even with the current Inline::C, depending upon how much time and energy you're prepared to devote in order to avoid the Perl API.
But mostly, it's not worth the effort.
(Of course, ideally you wouldn't even have to concern yourself with such matters when using Inline::C - and Ingy has indicated (in the link I provided earlier) that this might all be fixed in Inline::C following the Perl Conference that begins in the next day or so.
In the meantime, if you want to define PERL_NO_GET_CONTEXT, then I think you're generally going to have to create an XS module.
Cheers,
Rob
Indeed ... though it's also often the case that many functions that call the Perl API don't really need to.
Here's a simplistic example:
Both renditions of foo() do essentially the same thing.use strict; use warnings; use Inline C => Config => PRE_HEAD => '#define PERL_NO_GET_CONTEXT 1', ; use Inline C => <<'EOC'; /* SV * foo(int x) { return newSViv(x); } */ int foo(int x) { return x; } EOC my $x = foo(-1234);https://perlconference.us/tpc-2018-slc/ print $x;
But the rendition that has been commented out won't work when PERL_NO_GET_CONTEXT is defined, whereas the other rendition will.
So there are possibilities even with the current Inline::C, depending upon how much time and energy you're prepared to devote in order to avoid the Perl API.
But mostly, it's not worth the effort.
(Of course, ideally you wouldn't even have to concern yourself with such matters when using Inline::C - and Ingy has indicated (in the link I provided earlier) that this might all be fixed in Inline::C following the Perl Conference that begins in the next day or so.
In the meantime, if you want to define PERL_NO_GET_CONTEXT, then I think you're generally going to have to create an XS module.
Cheers,
Rob
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^9: Inline::C on Windows: how to improve performance of compiled code?
by BrowserUk (Patriarch) on Jun 17, 2018 at 04:07 UTC |
In Section
Seekers of Perl Wisdom