ENH #6416: performance improvements on write - tradoff higher memory use for faster writes.