Skip to main content

prepare

Function prepare 

Source
pub fn prepare()
Expand description

Build every precomputed table now, rather than on first use.

Under std, the generator tables for P-256, P-384 and P-521 and the Ed25519 basepoint tables are built the first time an operation needs them: about one scalar multiplication per curve, a few hundred microseconds in all on a host. They live in statics, so building them allocates nothing whenever it happens. What this changes is when the time is spent: a caller that wants its first handshake to cost what every later one does can pay it at start-up instead.

Safe to call more than once and from several threads: the work is done once, and a second caller waits for the first. Under no_std there are no tables, and this does nothing.