[core] Adding new optimizations for dense annotate writes to disk. Branch is not tested and might be unstable.