Skip to content

Specialize Poly1305's leWord to its byte function - #59

Merged
david415 merged 1 commit into
mainfrom
poly1305-specialize
Oct 27, 2026
Merged

david415 merged 1 commit into
mainfrom
poly1305-specialize

Conversation

@david415

Copy link
Copy Markdown
Member

Stacked on #58.

Poly1305.leWord took its bytes through a closure, so reading each 16-byte block made 16 lean_apply calls (visible as lean_apply_1 and leWord in a perf profile of huh's QUIC transfers). @[specialize] compiles a copy for each call site with the byte function inlined. No definition or proof changes.

before after
poly1305 1232 B 16 µs 8.3 µs
poly1305 64 KiB 0.99 ms 0.23 ms
chacha20-poly1305 encrypt 1200 B (with #58) 23 µs 17 µs

make test passes, including 316/316 Wycheproof ChaCha20-Poly1305 vectors.

@david415
david415 changed the base branch from chacha20-words to main October 27, 2026 20:22
@david415
david415 merged commit cefb4a7 into main Oct 27, 2026
3 checks passed
@david415
david415 deleted the poly1305-specialize branch October 27, 2026 20:22
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