print!/println! each acquire stdout's lock internally; doing that per streamed chunk in a tight loop adds needless contention. Lock once up front and write!/writeln! through the held handle instead — which also means the trailing newline must go through that same handle rather than println!, since re-locking from the same thread would deadlock. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| src | ||
| Cargo.toml | ||