Giter Site home page Giter Site logo

Comments (3)

weikengchen avatar weikengchen commented on July 4, 2024

The fact that ADD, SUB are slow also causes a mismatch about optimization. Many optimization techniques deployed in existing Rust code is around reducing multiplications and encouraging simpler additions and subtractions. The situation with RISC Zero at the moment, with the OP_MULTIPLY sub-syscall being very privileged, is different.

from risc0.

weikengchen avatar weikengchen commented on July 4, 2024

Below is the benchmark result for the examples/src/ecdsa in 0.20.1

Field operations:
add: 173 cycles
mul: 39 cycles
mul_single: 48 cycles
square: 39 cycles
negate: 31 cycles
invert: 9328 cycles

Scalar operations:
add: 225 cycles
mul: 147 cycles
square: 147 cycles
negate: 123 cycles
invert: 18294 cycles
invert_vartime: 17201 cycles

Group operations:
lincomb: 925349 cycles

from risc0.

weikengchen avatar weikengchen commented on July 4, 2024

Addition (without modular reduction) is about 4x overhead of modular multiplication right now. If it may overflow (this is always the case for secp256k1, but ed25519 offers some delay), another addition to fix the gap is needed, making it 8x.

This leads to a situation as follows: most of the curve formulas become equivalent in terms of performance because they usually have 6-7 adds. There are alternative representations that have even more adds, but does not seem to have any result that goes lower.

Optimization, therefore, would be mainly about NAF representations, endomorphisms, windows etc.

from risc0.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.