We have several methods that are advertised as variable-time which are returning CtOption instead of Option.
This is a bit suboptimal: CtOption eagerly evaluates its combinators, whereas Option uses lazy evaluation. It would generally be more efficient to use Option.
Perhaps a reason why this was the case originally was trouble converting from ConstCtOption to Option inside a const fn in the past, but there's now ctutils::CtOption::into_option_copied which can be used as a const fn, in cases where there's some shared code between the constant-time and non-constant-time versions of a function.
cc @andrewwhitehead @fjarri
We have several methods that are advertised as variable-time which are returning
CtOptioninstead ofOption.This is a bit suboptimal:
CtOptioneagerly evaluates its combinators, whereasOptionuses lazy evaluation. It would generally be more efficient to useOption.Perhaps a reason why this was the case originally was trouble converting from
ConstCtOptiontoOptioninside aconst fnin the past, but there's nowctutils::CtOption::into_option_copiedwhich can be used as aconst fn, in cases where there's some shared code between the constant-time and non-constant-time versions of a function.cc @andrewwhitehead @fjarri