Save only what changes, and only when something changes!
I've worked really hard to make sure performance is not negatively impacted by this feature, which has been frequently requested. In general:
* #find is no slower than before
* #save is not significantly slower than before, and may be much, much faster if there is no data to be saved
This patch supports in-place modification of data, both for text and for serialized objects. Note that this patch does incur a performance hit for serialized objects, because an md5 hash of the Marshal.dumped object is used to determine whether the object is "dirty" or not. This overhead is only incurred when the serialized object is read from the model, and again before each save. Also, given that serialized objects are not common, this seems a fair compromise, given the more general usefulness of the "smart save".
Also, in-place String modifications are about twice as slow as native string operations, but all other string operations are unchanged. However, my pb can still do 10,000 String#replace calls in about .16s, so it's still very, very fast.
Please, I'm hungry for feedback on this! Let me know what you think.