Add CRC32IEEE()/CRC64() support#7480
Conversation
Don't see how the patch can introduce this, maybe I need to rebase, will take a look |
zlib's implementation uses CRC-32-IEEE 802.3 polynomial (0xedb88320) but with starting value 0xffffffff, so introduce another crc32 implementation - CRC32IEEE that has starting value - 0 Also add CRC64 with ECMA polynomial. v2: s/crc*_data./crc*_data./ to avoid conflicts with other crc32.h in contrib v3: join with existing CRC32()
After crc32() had been replaced with crc32_z() the following error will happen with two different zlib: 2019-10-25 09:48:42 /usr/bin/ld.gold: error: contrib/zlib-ng/libz.a(crc32.c.o): multiple definition of 'get_crc_table' 2019-10-25 09:48:42 /usr/bin/ld.gold: contrib/mariadb-connector-c/libmariadb/libmariadbclient.a(crc32.c.o): previous definition here Fix this by using zlibstatic compiled for and by CH in mariadb-connector-c, and wrap into function reduce variable scopes.
|
@akuzm The code has some flaws, it transforms to technical debt. |
@alexey-milovidov can you write them down? |
|
Copy-paste from private TG channel. @akuzm will address all the concerns. Alexey Milovidov, [28.10.19 16:37]
А чем мотивировано, что функция должна так называться? Какое отношение отсутствие инициализации единичными битами имеет к IEEE? Есть какой-то стандарт, где такое прописано? Alexey Milovidov, [28.10.19 16:39] Каждая функция должна быть в отдельном файле. Не хватает теста производительности, потому что добавленные функции не используют PCLMUL. Alexey Milovidov, [28.10.19 16:39] Здесь код не соответствует стилю. Придётся переделывать. Alexey Milovidov, [28.10.19 16:41] А здесь atomic операции на каждое значение - вообще треш. Alexey Milovidov, [28.10.19 16:41] |
I couldn't think of anything better then this, and since IEEE is the name for the polynomial, (I though of accepting the polynomial as an parameter, but right now parameters exists only for aggregation functions AFAICS)
(sigh)
Just in case, I did some testing, and got the following with PCLMUL, and results indeed looks promising (but it depends from the data length as expected): Where: (And this does not have that static var of course) |
Category (leave one):
Short description (up to few sentences):
Add CRC32IEEE()/CRC64() support
Detailed description (optional):
zlib's implementation uses CRC-32-IEEE 802.3 polynomial (0xedb88320) but
with starting value 0xffffffff, so introduce another crc32
implementation - CRC32IEEE that has starting value - 0
Also add CRC64 with ECMA polynomial.