If you move this outside the range loop and keep adding contexts to writeContexts, the write performance will be better.