diff --git a/xtransmit/metrics.hpp b/xtransmit/metrics.hpp index 3045168..8ea587d 100644 --- a/xtransmit/metrics.hpp +++ b/xtransmit/metrics.hpp @@ -50,7 +50,8 @@ namespace metrics inline void generate_payload(vector& payload) { const int seqno = m_seqno++; - iota(payload.begin(), payload.end(), static_cast(seqno)); + // Using data() instead of begin() significantly improves performance. See #104. + iota(payload.data(), payload.data() + payload.size(), static_cast(seqno)); if (!m_enable_metrics) return;