Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Internally compressing Perl data

by asarih (Hermit)
on Apr 19, 2004 at 02:23 UTC ( #346179=perlquestion: print w/replies, xml ) Need Help??

asarih has asked for the wisdom of the Perl Monks concerning the following question:

A while ago, I asked the question Reconstructing an (SV *) when you know the address and the precise structure of the said SV.

As it turns out, this approach fails for the purpose of application (IPC::Door) that I sought the advice for, due to the (apparent) limitation of the library involved. (Documentation does not mention such limitation, however.) The library works, passing back and forth a pointer to a simple C data types such as int or char(I have not tested all C data types). And struct works, too, as long as struct itself contains no other pointers.

So, instead of the usual SV* , I need int* or char* or something like that to pass around. Obviously, one might consider Data::Dumper-esque approach of flattening data to an ASCII string and pass that around, but obviously this is an increasingly costly solution for larger data structures. If you have any suggestion on how to efficiently "flatten" perl's internal data, I'd appreciate it. I am not a very experienced C programmer, but I'd do my best to understand your suggestions! :)

Replies are listed 'Best First'.
Re: Internally compressing Perl data
by Zaxo (Archbishop) on Apr 19, 2004 at 02:36 UTC
Re: Internally compressing Perl data
by diotalevi (Canon) on Apr 19, 2004 at 03:26 UTC
Re: Internally compressing Perl data
by BUU (Prior) on Apr 19, 2004 at 11:13 UTC
Re: Internally compressing Perl data
by ctilmes (Vicar) on Apr 19, 2004 at 11:05 UTC
    Not sure if it will meet your needs in this case, but you might take a look at PDL. It uses more efficient internal structures for storing large arrays and has operators for working with them.
Re: Internally compressing Perl data
by samtregar (Abbot) on Apr 19, 2004 at 19:55 UTC
    If you're worried about performance, use Storable. It's very fast.


Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://346179]
Approved by Enlil
Front-paged by broquaint
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2022-08-17 19:55 GMT
Find Nodes?
    Voting Booth?

    No recent polls found