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

Re^2: PL_strtab/SHAREKEYS and copy-on-write leak

by eserte (Deacon)
on Aug 16, 2018 at 13:44 UTC ( [id://1220438]=note: print w/replies, xml ) Need Help??


in reply to Re: PL_strtab/SHAREKEYS and copy-on-write leak
in thread PL_strtab/SHAREKEYS and copy-on-write leak

Note that if you disable the shared key hash, then every object will use its own storage for every hash key. For example if a process creates 1000 objects, each being a hash with the same fixed set of keys (but differing values of course), then that process will store 1000 copies of each key.

But on the other hand, using shareable keys on data hashes where sharing is unlikely gives you overhead. If Devel::Size is correct then sharing a key adds 24 bytes.

Maybe it would be nice if it was possible to decide per-hash whether to share keys or not. Or even nicer, if perl objects wouldn't be based on hashes, then key sharing wouldn't be necessary at all.

  • Comment on Re^2: PL_strtab/SHAREKEYS and copy-on-write leak

Replies are listed 'Best First'.
Re^3: PL_strtab/SHAREKEYS and copy-on-write leak
by dave_the_m (Monsignor) on Aug 16, 2018 at 18:22 UTC
    The plan at some point is to introduce hash vtables. This will allow hashes to have varying implementations, which then opens up such possibilities.

    Dave.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-19 23:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found