Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Reading (the same) data in different ways & memory usage

by moritz (Cardinal)
on Apr 19, 2011 at 12:28 UTC ( [id://900098]=note: print w/replies, xml ) Need Help??


in reply to Reading (the same) data in different ways & memory usage

The first difference I see is that selectall_arrayref returns an array refs of array refs, whereas your homemade code seems to work with hash references. So maybe it's not the same size because the data structures are quite different?

$ perl -MDevel::Size=total_size -wE 'say total_size [1, 2, 3, 4]' 200 $ perl -MDevel::Size=total_size -wE 'say total_size { foo => 1, bar => + 2, baz => 3, blubb => 4}' 382

Replies are listed 'Best First'.
Re^2: Reading (the same) data in different ways & memory usage
by Neighbour (Friar) on Apr 19, 2011 at 12:44 UTC
    You can persuade selectall_arrayref to return an arrayref of hashrefs using the { Slice => {} } trick as described in the DBI manual.

    (edit) selectall_arrayref returns an arrayref, not an array :)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://900098]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (6)
As of 2025-07-14 14:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.