Live data from Hacker News

Pstore: Ruby Built-In Hash Persistence

github.com

41–42 of 42 posts

Re: Pstore: Ruby Built-In Hash Persistence

#41
post #15

Earlier quoted context omitted.

> use the Ox gem The main thing is that it's part of the standard library. If you import a gem anyway, often you'd be well off with sqlite. As for storage format, there's also: https://ruby-doc.org/stdlib-3.1.2/libdoc/yaml/rdoc/YAML/Stor...

I don't get the value of "it's in the standard library". Ruby has the amazing (fir scripts) require "bundler/inline" that allows you to use a single file for code and Gemfile, as well as auto installing the dependencies, so going for standard library doesn't seem to provide any practical value except offline support

I used pstore for an ad-hoc monitoring service on an outdated windows server running an outdated ruby version - it was easy to set it up to run from task scheduler every five minutes and check resident memory of an old ruby service - logging the ram, and killing/restarting it if it was over 1 GB (this all on 32bit ruby with the limits of 4gb address space per process).

Sure there are many things that "should" have been fixed above - but just having any old ruby version on hand was enough to help check for a memory leak and mitigate it - while taking the time to figure out if the leak could be plugged.

And offline support (a server in dmz/locked down wrt new software) is big too!

Re: Pstore: Ruby Built-In Hash Persistence

#42

Earlier quoted context omitted.

Why the "don't use it"? Just say "use it with caution" or, since we are being rude telling people what to do whenever pickle or marshal comes up, just don't say anything and assume people know what they are doing.

I don't think I phrased that in a particularly rude way, but I'm sorry if it came across as rude. The answer is that we have serialization techniques that are as good on all the dimensions that matter (speed, serialized size, etc.) and better in terms of security. Pickle and Marshal are, at best, footguns in otherwise very safe language ecosystems.

> The answer is that we have serialization techniques that are as good on all the dimensions that matter

I'd look at that sentence with great skepticism. What could possibly surpass a conversion to raw object representation? Do you mean libraries which require you to use protocol languages like protobuf or inheritance?

Post reply on HN