Optimize merge_updates
Optimize merge_updates

There are two basic strategies here.  We move the function clauses which
are matched less often to the end of the function definition, and we use
a body-recursive implementation instead of tail-recursion with a final
reverse.  The latter change is motivated by the implementation of
orddict:merge/3 in the stdlib, and simple benchmarks on R14B04 indicate
that the body recursive implementation is faster for all batch sizes.

fkaempfer/couchdb,fkaempfer/couchdb,fkaempfer/couchdb,fkaempfer/couchdb,fkaempfer/couchdb,fkaempfer/couchdb