[FEATURE] Refactor available features
Alexhuszagh opened this issue · 2 comments
Alexhuszagh commented
Problem
It is currently impossible to do a lot of things, without private forks of lexical-core.
- Cannot have optionally-trimmed floats (IE, "12.0" and "12").
- Cannot use correct (slow) and incorrect (fast) parsers at the same time.
- Heavy reliance on global state (#45).
There are also numerous features that are rarely used (including some undocumented ones), and have dubious utility:
table
(should be the default, sincecorrect
depends on it).unchecked_index
(introduces security risks if enabled, and has no tangible performance benefits).libm
(should be enabled by default, see #61).noinline
(debugging tools, no longer used).format
(should be enabled by default, with fast-path algorithms to avoid overhead).
Alexhuszagh commented
Currently, this is fully implemented as of 40c59a3#diff-2e9d962a08321605940b5a657135052fbcef87b5e360662bb527c96d9a615542.
The features removed are:
table
unchecked_index
libm
noinline
The added features are:
no_alloc
(enabled by default, avoid using a system allocator except whenradix
is enabled).
We've also broken the crate into submodules, which are featured-gated:
parse_floats
(enabled the float parser).parse_integers
(enabled the integer parser).write_floats
(enabled the float writer).write_integers
(enabled the integer writer).
The new submodules should lead to faster compile times when features are disabled.
I will be keeping this issue until the v0.8 version is published.
Alexhuszagh commented
Closed as of lexical v6.0.0 and lexical-core v0.8.0.