mirror of
https://github.com/smoltcp-rs/smoltcp.git
synced 2025-10-02 15:15:05 +00:00
Fix benchmark and update results
This commit is contained in:
parent
ef67e7b46c
commit
f7d39d72a1
@ -513,14 +513,14 @@ cargo run --release --example benchmark -- --tap tap0 [reader|writer]
|
||||
It establishes a connection to itself from a different thread and reads or writes a large amount
|
||||
of data in one direction.
|
||||
|
||||
A typical result (achieved on a Intel Core i7-7500U CPU and a Linux 4.9.65 x86_64 kernel running
|
||||
on a Dell XPS 13 9360 laptop) is as follows:
|
||||
A typical result (achieved on a Intel Core i5-13500H CPU and a Linux 6.9.9 x86_64 kernel running
|
||||
on a LENOVO XiaoXinPro 14 IRH8 laptop) is as follows:
|
||||
|
||||
```
|
||||
$ cargo run -q --release --example benchmark -- --tap tap0 reader
|
||||
throughput: 2.556 Gbps
|
||||
throughput: 3.673 Gbps
|
||||
$ cargo run -q --release --example benchmark -- --tap tap0 writer
|
||||
throughput: 5.301 Gbps
|
||||
throughput: 7.905 Gbps
|
||||
```
|
||||
|
||||
## Bare-metal usage examples
|
||||
|
@ -1,5 +1,3 @@
|
||||
#![allow(clippy::collapsible_if)]
|
||||
|
||||
mod utils;
|
||||
|
||||
use std::cmp;
|
||||
@ -121,16 +119,14 @@ fn main() {
|
||||
socket.listen(1234).unwrap();
|
||||
}
|
||||
|
||||
if socket.can_send() {
|
||||
if processed < AMOUNT {
|
||||
let length = socket
|
||||
.send(|buffer| {
|
||||
let length = cmp::min(buffer.len(), AMOUNT - processed);
|
||||
(length, length)
|
||||
})
|
||||
.unwrap();
|
||||
processed += length;
|
||||
}
|
||||
while socket.can_send() && processed < AMOUNT {
|
||||
let length = socket
|
||||
.send(|buffer| {
|
||||
let length = cmp::min(buffer.len(), AMOUNT - processed);
|
||||
(length, length)
|
||||
})
|
||||
.unwrap();
|
||||
processed += length;
|
||||
}
|
||||
|
||||
// tcp:1235: sink data
|
||||
@ -139,16 +135,14 @@ fn main() {
|
||||
socket.listen(1235).unwrap();
|
||||
}
|
||||
|
||||
if socket.can_recv() {
|
||||
if processed < AMOUNT {
|
||||
let length = socket
|
||||
.recv(|buffer| {
|
||||
let length = cmp::min(buffer.len(), AMOUNT - processed);
|
||||
(length, length)
|
||||
})
|
||||
.unwrap();
|
||||
processed += length;
|
||||
}
|
||||
while socket.can_recv() && processed < AMOUNT {
|
||||
let length = socket
|
||||
.recv(|buffer| {
|
||||
let length = cmp::min(buffer.len(), AMOUNT - processed);
|
||||
(length, length)
|
||||
})
|
||||
.unwrap();
|
||||
processed += length;
|
||||
}
|
||||
|
||||
match iface.poll_at(timestamp, &sockets) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user