[Israel.pm] cases for using XS code
shmuelfomberg at gmail.com
Wed Feb 29 23:37:43 PST 2012
Having a C library is certainly a use case.
But also speed - of course XS will be faster then Perl.
That "of course" is assuming that the XS code does not have a lot of
interaction with the Perl code. it should be called, suck its parameters,
do its work and return results.
If you start with callbacks and Perl data manipulation, the speed boost is
not so much.
Also, when you write code in C you have the benefit of using data
structures other the Perl's hash/array/scalar. For example, in one project
I managed to get an additional speed boost due to the fast that I used
trees (STL's map) instead of hashs, I could tranvarse the trees in parallel
instead of tranvarsing one and fetch from the others.
On Thu, Mar 1, 2012 at 4:25 PM, Michael Gang <michaelgang at gmail.com> wrote:
> Hi all,
> When would it be appropriate to write XS code?
> One obvious example is when i have a c library and i want to bind it to
> Are there cases when XS code performs better then pure perl code?
> If yes, in which cases?
> Perl mailing list
> Perl at perl.org.il
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Perl