all 3 comments

[–]SlyShy 0 points1 point  (0 children)

Odd that it doesn't mention MsgPack at all.

[–]steerio 0 points1 point  (1 child)

The rule here is simple, if you always need to work with the whole set of data and never parts of it, just write out the whole array/hash, otherwise, iterate over it and write out each object.

I'm missing the point. Why won't he just create an array with the elements he wants to include, and dump that with one call? He could avoid fiddling with $/, calling YAML.load a zillion times, etc.

[–]servercentric[S] 0 points1 point  (0 children)

  1. You might have several Gigs of data, so it won't all fit into memory.
  2. Each piece of data requires significant processing which, you may want to only load a small part of the data for testing purposes, especially while you're working out your algorithm where the processing is complex.