maxsharabayko / srt-xtransmit

SRT transmission application used for testing
40 stars 17 forks source link

Improve generator performance by bypassing std::vector checks. #104

Closed maxsharabayko closed 5 days ago

maxsharabayko commented 5 days ago

25 Mbps sending on MX4.

Before:

image

After:

image

maxsharabayko commented 5 days ago

Group 25 Mbps sending (2 members)

Before: image

After: image

maxsharabayko commented 4 days ago

Nonabench does not show any notable difference though.


|               ns/op |                op/s |    err% |          ins/op |          cyc/op |    IPC |         bra/op |   miss% |     total | benchmark
|--------------------:|--------------------:|--------:|----------------:|----------------:|-------:|---------------:|--------:|----------:|:----------
|              375.68 |        2,661,822.68 |    1.0% |          565.09 |          446.53 |  1.266 |          93.00 |    1.3% |      0.01 | `iota on vector::data()`
|              376.70 |        2,654,634.99 |    1.2% |          565.09 |          446.59 |  1.265 |          93.00 |    1.3% |      0.01 | `iota on vector::begin()`
#include <numeric>
#include <vector>

#define ANKERL_NANOBENCH_IMPLEMENT
#include <nanobench.h>

int main() {
    std::vector<char> payload(1500);
    char seqno = 0;

    ankerl::nanobench::Bench().run("iota on vector::data()", [&] {
        std::iota(payload.data(), payload.data() + payload.size(), seqno);
        ++seqno;
        });

    seqno = 0;
    ankerl::nanobench::Bench().run("iota on vector::begin()", [&] {
        std::iota(payload.begin(), payload.end(), seqno);
        ++seqno;
        });
}