Handle duplicate timestamps

Duplicate timestamps are handled automatically with last-written wins.
In addition, the compaction code is cleaned up and unified - instead of
having separate code paths for trivial and complex compactions, there is
only one code path.  However, it is faster than the trivial path was
before, particularly for large rows - on my laptop, a row of 3600 1-sample values was 10-20% faster, and 3600000 1-sample values was nearly twice as fast.  It is even faster compared to the previous complex path.