Skip to content

Encode plaintext at highest used level instead of max level - #3332

Merged
copybara-service[bot] merged 1 commit into
mainfrom
mdgrs/encodePlaintext
Aug 12, 2026
Merged

Encode plaintext at highest used level instead of max level#3332
copybara-service[bot] merged 1 commit into
mainfrom
mdgrs/encodePlaintext

Conversation

@mdgrs

@mdgrs mdgrs commented Aug 12, 2026

Copy link
Copy Markdown
Collaborator

For the Lola test that uses Lattigo, the encode time goes from 357 ms to 288 ms, and the memory use goes from 125 MB to 84 MB.

@mdgrs
mdgrs requested review from AlexanderViand and j2kun August 12, 2026 13:43
Comment on lines +97 to +99
Run this after CSE. Identical encode ops that CSE has merged are cheaper as
one plaintext at the highest level than as several at their own levels,
since each encode pays a fixed cost on top of the per-limb work.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL!

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works fine, though this kind of problem is the poster-child for a backwards dataflow analysis (lattice join is to take the max). I'd say only worry about it if this ends up having performance issues.

@j2kun j2kun added the pull_ready Indicates whether a PR is ready to pull. The copybara worker will import for internal testing label Aug 12, 2026
@copybara-service
copybara-service Bot merged commit 0357a0b into main Aug 12, 2026
25 checks passed
@copybara-service
copybara-service Bot deleted the mdgrs/encodePlaintext branch August 12, 2026 18:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pull_ready Indicates whether a PR is ready to pull. The copybara worker will import for internal testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants