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

Benchmark PDU loop #25

Merged
merged 6 commits into from
Mar 16, 2023
Merged

Benchmark PDU loop #25

merged 6 commits into from
Mar 16, 2023

Conversation

jamwaffles
Copy link
Collaborator

This is the most pure/basic possible benchmark of the PDU loop. It:

  1. Prepares a FPWR frame with 8 bytes of payload data (32 bytes total) and marks it as sendable
  2. Writes an Ethernet II packet containing the EtherCAT frame into a buffer
  3. Passes the buffer to receive_frame which parses the data back out of the buffer

This test doesn't include any networking (not even loopback) because I'm on Windows so it's more a theoretical benchmark to check for regressions in the code than a real-world representation. On my Windows 11 (🤮) Ryzen 9 5950X system I get:

pdu-loop/elements       time:   [256.58 ns 257.65 ns 259.05 ns]
                        thrpt:  [3.8603 Melem/s 3.8812 Melem/s 3.8974 Melem/s]

pdu-loop/payload bytes  time:   [259.66 ns 261.35 ns 263.59 ns]
                        thrpt:  [28.944 MiB/s 29.193 MiB/s 29.382 MiB/s]

3.8m full frames/sec or 29MiB/sec EtherCAT payload of 8 bytes. I'm sure we can do better but this is a decent starting baseline.

I'll add a Linux benchmark when my test rig arrives which can involve sending traffic over the loopback interface for a more representative sample of the performance.

@jamwaffles jamwaffles merged commit 4d77c7f into master Mar 16, 2023
@jamwaffles jamwaffles deleted the benchmark-pdu-loop branch March 16, 2023 21:31
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