Opened 7 years ago
Closed 7 years ago
#11590 closed Patches (fixed)
cpp_int initialization inefficient
Reported by: | Owned by: | John Maddock | |
---|---|---|---|
Milestone: | To Be Determined | Component: | multiprecision |
Version: | Boost 1.57.0 | Severity: | Optimization |
Keywords: | Cc: |
Description
I tried to create an cpp_int with about 10 million digits from a hex string "0x1....1"; it literally take ages. The reasons seems to be the repeated shift and add conversion from the characters; while that is inevitable for decimal digits, a hex encoded string would allow to directly determine the final position and shift in the corresponding limb.
TODO: check supplied string for valid hex encoding, allocate enough zero-initialized limbs and then directly set the value of the corresponding limb.
A further improvement would be to supply a conversion from a sequence of values that are stored in some linear container.
Change History (2)
comment:1 by , 7 years ago
comment:2 by , 7 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
I believe this is now fixed in develop for hex and octal numbers.
Docs for import/export to external storage here: https://rawgit.com/boostorg/multiprecision/develop/doc/html/boost_multiprecision/tut/import_export.html, comments welcome.
Will fix shortly.