Yaw!
I built a C library / demo app that demonstrates how libsecp256k1 can be used to do really fast batch addition and scan a given range from start to finish.
The resulted affine points can be streamed and consumed via callbacks, or this can be simply used as a crude measurement instrument to check your CPU's performance.
https://github.com/kTimesG/PointsBuilderHow it works?
- give it a range start, a size, and a number of threads to use. The rest is magic!
Only two EC point multiplications are only ever needed. For example, if you need to fully generate all the first 1 billion points starting from some scalar k (only 64 bit for this demo), and do it on 64 threads, you only
need two initial point multiplications!The code computes a constant points array, with G increments.
Batch addition is then handled directly using secp256k1 arithmetics.
The algorithm for my implementation of a batch addition is highly optimized - it is NOT the usual algorithm you might have seen elsewhere.
The goal of this demo is to show that it can run really, really FAST - in my tests, it's at least two times faster than the usual suspects that you may find in other projects, especially the ones in almost all VanitySearch projects and their clones.
The demo also allows saving the X coordinates into a database - this is not the goal of the code though.
You can run simple benchmarks by not specifying a database for storing results (because actually storing the results is several hundreds times slower than computing them in RAM).
Important note (forgot to add it in the GitHub README): the range start needs to be above 1024 (because otherwise the results will be incorrect - point doubling is assumed to never happen in the batch adder logic).
Note: this thread is self-moderated. Please no BS / AI / non-sense, except things that are related to this library.
What is the main purpose of the code.