perf improvement for mark_delivered