Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix fast 1-weso parameter approximation, for massive speedup
The "fast" 1-Wesolowski prover inadvertently mixed up parameters in the call to ApproximateParameter. ApproximateParameter's signature has L followed by K: void ApproximateParameters(uint64_t T, uint32_t& L, uint32_t& K) However, the 1-Weso calls used K followed by L: ApproximateParameters(num_iterations, k, l); While this typo does not affect the correctness of the created 1-Weso proof, this causes 1-Weso proving to be _much_ slower than necessary. In isolated testing, the 1-Weso proof generation is up to 10x slower. Funnily enough, the "slow" VDF impl (in `src/provers_slow.h`) uses a separate 1-Weso prover implementation which _doesn't_ suffer from this bug, thus making the "slow" VDF impl faster than the "fast" overall. To be clear: the fixed bug _only_ affects the _performance_ (not the correctness!) of computing 1-Weso proofs (thus, blueboxing) using the "fast" implementation. Regular software timelords (N-Weso), hardware (ASIC) timelords, and the "slow" bluebox implementation are unaffected. The speedup can be observed/tested by running `src/1weso_test.cpp`: $ hyperfine --warmup 5 "./1weso_test.orig" "./1weso_test.fixed" Benchmark 1: ./1weso_test.orig Time (mean ± σ): 17.250 s ± 1.153 s [User: 23.946 s, System: 0.037 s] Range (min … max): 15.582 s … 18.372 s 10 runs Benchmark 2: ./1weso_test.fixed Time (mean ± σ): 8.746 s ± 0.010 s [User: 14.651 s, System: 0.029 s] Range (min … max): 8.733 s … 8.765 s 10 runs Summary ./1weso_test.fixed ran 1.97 ± 0.13 times faster than ./1weso_test.orig
- Loading branch information