Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add noble to benchmark #7

Merged
merged 5 commits into from
Feb 28, 2024
Merged

Conversation

twoeths
Copy link
Contributor

@twoeths twoeths commented Aug 1, 2023

Add noble to benchmark tests

beforeEach: () => new Uint8Array(sealed),
fn: (clonedSealed) => {
jsImpl.open(nonce, clonedSealed, ad, clonedSealed.subarray(0, clonedSealed.length - TAG_LENGTH));
chacha20poly1305Noble(key, nonce, ad).decrypt(clonedSealed);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
chacha20poly1305Noble(key, nonce, ad).decrypt(clonedSealed);
chacha20poly1305Noble(key, nonce, ad).decrypt(clonedSealed, clonedSealed.subarray(0, clonedSealed.length - TAG_LENGTH));

to reuse buffer?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I switched to always populate a new result every time so that I can use runsFactor to benchmark more precisely. All implementations have to populate dst result so should be no issue comparing them.

// seal
for (const {impl, sealFn} of testCases) {
itBench({
id: `${impl} seal ${formatBytes(dataLength)}`,
Copy link

Choose a reason for hiding this comment

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

Format in reverse to it's easier to read,

Suggested change
id: `${impl} seal ${formatBytes(dataLength)}`,
id: `${formatBytes(dataLength)} seal ${impl}`,

@wemeetagain wemeetagain merged commit 75a7a23 into main Feb 28, 2024
7 checks passed
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.

4 participants