zkmopro / mopro

Making client-side proving on mobile simple.
Apache License 2.0
102 stars 28 forks source link

Feat/window-wise msm with precomputation acceleration on CPU #187

Closed moven0831 closed 10 hours ago

moven0831 commented 3 days ago

Summary

This PR experiments with accelerating Arkworks MSM on the CPU using precomputation techniques. The result shows that while window-wise MSM with precomputation provides a slight speedup, the increased I/O and serialize/deserialize overhead are not worth it.

Check on this report for more detail: https://hackmd.io/v8WPAG8-RsCANrbv_seSXw

Status

This PR

Implement the generation for precomputed point and related serde methods. Adapted the Arkworks MSM algorithm to use the precomputed points.

benchmark result (on MacBook with M3 chip)

similar to Arkworks MSM, sometimes are slightly faster but not significant

msm time (ms) / instance size 2^10 2^16 2^18 2^20 2^22 2^24
Arkworks msm 2.68 67.96 245.38 912.32 3641.81 14254.36
Window-wise MSM with precomputation
(on CPU)
2.13 65.83 234.32 915.91 x x

The relationship among acceleration speed, size of precomputation points and time for precomputation is as follow: