Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 26, 2024

Conversation

maxsharabayko
Copy link
Owner

25 Mbps sending on MX4.

Before:

image

After:

image

@maxsharabayko
Copy link
Owner Author

Group 25 Mbps sending (2 members)

Before:
image

After:
image

@maxsharabayko maxsharabayko merged commit 61b642d into master Nov 26, 2024
6 checks passed
@maxsharabayko maxsharabayko deleted the hotfix/gen-perf-improve branch November 26, 2024 11:45
@maxsharabayko
Copy link
Owner Author

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;
		});
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant