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

Rearrange SDK client supported checksum algorithms in the priority order of their performance #6499

Closed
1 of 2 tasks
trivikr opened this issue Sep 19, 2024 · 2 comments · Fixed by #6500
Closed
1 of 2 tasks
Labels
feature-request New feature or enhancement. May require GitHub community feedback. p2 This is a standard priority issue queued This issues is on the AWS team's backlog

Comments

@trivikr
Copy link
Member

trivikr commented Sep 19, 2024

Describe the feature

Rearrange SDK client supported checksum algorithms in the priority order of their performance

Use Case

When flexible checksums was implemented, the priority order algorithms were predetermined from different SDK, and they were not profiled.

There's a ToDo

* ToDo: update the priority order based on profiling of JavaScript implementations.

Ordering SDK client supported checksum algorithms in the priority order of their performance will improve the time take for validation.

Proposed Solution

Write a benchmark similar to https://github.com/trivikr/benchmark-crc32 for all supported algorithms, and order them based on performance

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

SDK version used

All

Environment details (OS name and version, etc.)

Node.js

@trivikr trivikr added feature-request New feature or enhancement. May require GitHub community feedback. needs-triage This issue or PR still needs to be triaged. p2 This is a standard priority issue queued This issues is on the AWS team's backlog and removed needs-triage This issue or PR still needs to be triaged. labels Sep 19, 2024
@trivikr
Copy link
Member Author

trivikr commented Sep 20, 2024

The benchmarks comparing checksum implementations used by AWS SDK for JavaScript were added in trivikr/benchmark-checksums#1

Copying for visibility

Benchmark for buffer of size 16 KB:
crc32 x 5,847 ops/sec ±0.94% (97 runs sampled)
crc32c x 5,696 ops/sec ±2.56% (95 runs sampled)
sha1 x 115,813 ops/sec ±3.62% (89 runs sampled)
sha256 x 117,583 ops/sec ±2.80% (87 runs sampled)
Fastest is sha256,sha1

Benchmark for buffer of size 64 KB:
crc32 x 1,438 ops/sec ±0.58% (97 runs sampled)
crc32c x 1,378 ops/sec ±4.90% (93 runs sampled)
sha1 x 33,010 ops/sec ±2.74% (91 runs sampled)
sha256 x 34,076 ops/sec ±1.57% (91 runs sampled)
Fastest is sha256

Benchmark for buffer of size 256 KB:
crc32 x 361 ops/sec ±1.13% (93 runs sampled)
crc32c x 367 ops/sec ±0.43% (94 runs sampled)
sha1 x 9,096 ops/sec ±0.43% (101 runs sampled)
sha256 x 9,178 ops/sec ±0.58% (100 runs sampled)
Fastest is sha256

Benchmark for buffer of size 1024 KB:
crc32 x 90.94 ops/sec ±0.36% (79 runs sampled)
crc32c x 90.49 ops/sec ±0.47% (79 runs sampled)
sha1 x 2,261 ops/sec ±1.45% (96 runs sampled)
sha256 x 2,111 ops/sec ±7.35% (91 runs sampled)
Fastest is sha1

Based on benchmark results, the new priority order will be as follows:

export const PRIORITY_ORDER_ALGORITHMS = [
  ChecksumAlgorithm.SHA256,
  ChecksumAlgorithm.SHA1,
  ChecksumAlgorithm.CRC32,
  ChecksumAlgorithm.CRC32C,
];

Copy link

github-actions bot commented Oct 5, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request New feature or enhancement. May require GitHub community feedback. p2 This is a standard priority issue queued This issues is on the AWS team's backlog
Projects
None yet
1 participant