You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While implementing sum for decimal, I tried a test of adding 1 to 1E123456 and noticed that during serialization, we convert a base10 varint with 123456 digits to a base 256 varint. This has been implemented using multiply and add and it is an O(n^2) algorithm where n is the number of digits.
…from OpenSSL
Summary:
Our implementation of VarInt has a lot of ineffective conversions between bases, unnecessary copying, memory allocations etc.
Also it does not contain fast algorithms for large integers.
Replaced our implementation of VarInt with BIGNUM from OpenSSL.
Test Plan:
ybd --cxx-test varint-test
ybd --cxx-test decimal-test
Reviewers: timur, mikhail, hector, bogdan, kannan
Reviewed By: hector, bogdan, kannan
Subscribers: karthik, bogdan, kannan, ybase
Differential Revision: https://phabricator.dev.yugabyte.com/D6234
While implementing sum for decimal, I tried a test of adding 1 to 1E123456 and noticed that during serialization, we convert a base10 varint with 123456 digits to a base 256 varint. This has been implemented using multiply and add and it is an O(n^2) algorithm where n is the number of digits.
The offending code is the following:
This could be replaced with a more efficient algorithm which runs in O(n log n)
The text was updated successfully, but these errors were encountered: