Do fast path encoding in a single loop