Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Storing state of execution

by SuicideJunkie (Vicar)
on Dec 09, 2015 at 15:05 UTC ( [id://1149777]=note: print w/replies, xml ) Need Help??


in reply to Re: Storing state of execution
in thread Storing state of execution

I would add that which you want depends a lot on the data you need to store.

If the data is simple and modestly sized, then JSON (or YAML) would probably be best.

If your data includes reference loops or binary data, or if the data structure is large (speed becomes an issue) then Storable would probably be best.

Dumper is more of a middle ground, if you need it to be coder-readable and it is a complex data structure, but you can absolutely trust the source of the data when you read it back. I'd only recommend it as debug output, since reading it back in involves running arbitrary perl code.

Replies are listed 'Best First'.
Re^3: Storing state of execution (speed)
by tye (Sage) on Dec 09, 2015 at 16:01 UTC
    or if the data structure is large (speed becomes an issue) then Storable would probably be best.

    That doesn't match my memory. A quick test showed JSON::XS taking just over 1/3 of the time of Storable (and producing almost exactly the same number of bytes of output).

    Using JSON has other advantages. And I consider forcing one to stick to simple data to be one of them.

    - tye        

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (3)
As of 2024-03-29 07:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found