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

reimplement crc64ecma_sw to reduce redundancy #700

Merged
merged 1 commit into from
Jan 20, 2025

Conversation

lihuiba
Copy link
Collaborator

@lihuiba lihuiba commented Jan 16, 2025

Reimplement crc64ecma_sw to reduce redundant code, by unifying crc32 and crc64.
And make the table generated dynamically at runtime, so as to reduce redundant static data that is rarely used today, given that crc hw is common.

 common/checksum/{crc32c.cpp => crc.cpp} | 459 +++++++++-------------------------------------------------------------------------
 common/checksum/crc64ecma.cpp           | 221 ----------------------------------------

@lihuiba lihuiba requested review from beef9999 and Coldwings January 16, 2025 16:25
@lihuiba lihuiba force-pushed the reimplement_crc64ecma branch 2 times, most recently from ba237b4 to 645d0c3 Compare January 16, 2025 16:43
@@ -767,407 +762,54 @@ uint64_t crc64ecma_hw(const uint8_t *buf, size_t len, uint64_t crc) {
return crc64ecma_hw_portable(buf, len, crc);
}

template<typename T, T POLY>
Copy link
Collaborator

Choose a reason for hiding this comment

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

The table is able to create in compile-time, by using template.

why create it in runtime?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

that is rarely used today, given that crc hw is common.

Copy link
Collaborator Author

@lihuiba lihuiba Jan 17, 2025

Choose a reason for hiding this comment

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

it's a waste in both compile time and binary size to generate the table in compile-time.

@lihuiba lihuiba force-pushed the reimplement_crc64ecma branch 3 times, most recently from 2549b7c to 63f61eb Compare January 18, 2025 02:52
@lihuiba lihuiba requested a review from Coldwings January 18, 2025 02:52
@lihuiba lihuiba force-pushed the reimplement_crc64ecma branch from 63f61eb to fed9e9d Compare January 19, 2025 02:49
and make the table generated dynamically at runtime,
so as to reduce redundant static data that is rarely today,
given that crc hw is common.
@lihuiba lihuiba force-pushed the reimplement_crc64ecma branch from fed9e9d to cd591b3 Compare January 19, 2025 03:43
@lihuiba lihuiba merged commit 3224e28 into alibaba:main Jan 20, 2025
12 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.

2 participants