While the option is fair enough, I don't thing all existing apps
wouldn't want this turned on "silently":
- if other people use your database yaml is ok as there are parsers
for it in many languages whereas Marshal would be a PITA
- if your existing column is not a blob column (which it wouldn't have
to be previously since yaml generates plain text), the database will
throw a hissy fit (or just truncate the data) when you try to insert a
character that is not legal in the charset used.
- should you be calling string_to_binary if the column supports it ?
Fred
> Simple enough?
>
> Stephen
> >
You could add the option, but it should never become a default. And
even an option should come with a big warning.
izidor
>
> I did a quick benchmark of ZAML and found it to be slower:
>
> http://pastie.org/288592
>
I swapped the IO for a StringIO and ZAML was then twice as fast:
user system total real
yaml 0.360000 0.010000 0.370000 ( 0.375689)
zaml 0.150000 0.000000 0.150000 ( 0.154976)
>
making the dumped object a little less trivial (seems to me like the
initial test only really tests the overhead in getting things set up)
further increases the difference
to_dump = ['foo', 'bar', 'baz', Time.now, {'key' => 'value', 'bar' =>
{1 => 'hello', 2 => 'world'}}]*5
yaml 9.260000 0.060000 9.320000 ( 9.413077)
zaml 2.790000 0.010000 2.800000 ( 2.827708)