Code Monkey home page Code Monkey logo

Comments (5)

xrchz avatar xrchz commented on May 21, 2024

Weeding out the zeros does look tricky, though maybe it's worth benchmarking if it's worthwhile? One way to do it would be to make a copy of p (and coeffs), then make a single pass over it swapping any zeros (and the corresponding coeff) with the last element.

from c-kzg-4844.

asn-d6 avatar asn-d6 commented on May 21, 2024

Wrote a unittest that demonstrates the bug: 8b7ef36

And a demontration of the simple fix: 84c9ef9

Marked the PR as draft for now. Will give a shot at the "weed out zeroes" approach later.

from c-kzg-4844.

asn-d6 avatar asn-d6 commented on May 21, 2024

Weeding out the zeros does look tricky, though maybe it's worth benchmarking if it's worthwhile? One way to do it would be to make a copy of p (and coeffs), then make a single pass over it swapping any zeros (and the corresponding coeff) with the last element.

I did not feel smart enough to do the swapping strategy, so I implemented a more naive weeding out strategy here: asn-d6@42f6e18 That was a quick implementation for benchmarking; the logic is a bit dicey so there might be bugs.

The benefits of the weeding out strategy start to be visible in batch verify with n=16 where we get an 8% speed boost, and at n=32 we get a 10% speed boost. For smaller n the performance is almost identical (after all we always do the naive MSM for n < 8).

My intuition tells me to go with the simple strategy of #140 upstream for now, and if this performance ever becomes problematic we can switch to the more involved weeding out strategy. After all, IIUC we mainly care for mempool verification performance where transactions are not gonna have multiple blobs.

from c-kzg-4844.

asn-d6 avatar asn-d6 commented on May 21, 2024

Here is a proper implementation of the weed out strategy: #156

I would appreciate a review here as this significantly complicates the logic of g1_lincomb()
/cc @jtraglia @xrchz @dankrad

from c-kzg-4844.

asn-d6 avatar asn-d6 commented on May 21, 2024

Closing this in favor of #156 (comment)

from c-kzg-4844.

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.