Yes, indeed. This should be the approach. However, (there's always one :), I want the serialization function to handle a big data structure, which can contain these blessed objects rather deep inside it.
Since the main purpose of all this mess is to speed up things, I thought I'd want to pass a reference to this "big structure" and then the XS function would do the heavy work.
Doing as you say, and I've tried that before, probably means that I must move all the data structure traversal outside of XS. Example:
my $big_struct = [ {a=>1}, {b=>2}, [1, 2, 3, 4, 5], ['blah', 'blah', ['bluh', $blessed_object]], {d=>3, e=>[1,2,3]} ];
If I want to correctly handle $blessed_object from XS, I must call its toString() (assume for now it has one) with call_sv().
Doing this from Perl code, means I must shift all the structure traversal from XS to Perl... losing a share of the speed gain...
In reply to Re^2: Problem on perl callbacks from XS
by cosimo
in thread Problem on perl callbacks from XS
by cosimo
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |