smoltcp-rs / smoltcp

a smol tcp/ip stack
BSD Zero Clause License
3.63k stars 402 forks source link

ignore checksum during loopback #919

Closed skpupil closed 2 months ago

skpupil commented 2 months ago

There is no need to check the checksum during loopback. According to tests, this optimization improves performance by more than 30%.

whitequark commented 2 months ago

Do we... care about loopback performance?

skpupil commented 2 months ago

Do we... care about loopback performance?

We don't check the checksum during loopback according to the Linux network stack. The performance improvement then becomes just a fringe benefit. BTW, if we aim to identify the performance bottleneck of smoltcip, it's easier to do so after excluding checksum checking.

whitequark commented 2 months ago

That is true in some cases, though I would expect most performance bottlenecks to come from the relatively (compared to e.g. Linux) immature TCP implementation, not the basic and straightforward bit manipulation code.

skpupil commented 2 months ago

That is true in some cases, though I would expect most performance bottlenecks to come from the relatively (compared to e.g. Linux) immature TCP implementation, not the basic and straightforward bit manipulation code.

emmm, perhaps both are needed. I'll try my best to do more. Thx.