You should probably skip the write unless `last < i`. If this is writing to e.g. a libnative Writer then I believe it will end up calling POSIX `write()` with an empty string otherwise, which is quite wasteful.