mimblewimble / secp256k1-zkp

Fork of secp256k1-zkp for the Grin/MimbleWimble project
MIT License
32 stars 42 forks source link

Why not use GMP num? #50

Closed spartucus closed 3 years ago

spartucus commented 5 years ago

From here, the library use builtin num instead of GMP num.

#define USE_NUM_NONE 1
#define USE_FIELD_INV_BUILTIN 1
#define USE_SCALAR_INV_BUILTIN 1
#define USE_FIELD_10X26 1
#define USE_SCALAR_8X32 1

I tested it on local, GMP version is 3 times faster than builtin. What's the consideration?

garyyu commented 5 years ago

@spartucus interesting, what test did you launch for getting that 3 times faster result?

spartucus commented 5 years ago

I tested it use our algorithms based on this repo, the algorithms was contains the following functions: secp256k1_ecmult, secp256k1_ecmult_gen, scalar, ge, sha256 related functions.

Sorry the code is not open sourced, so I can't tell much about it.

It was not the perfect test model, but when I call it use GMP version, it takes 4ms, and for builtin version, it takes 13ms.

My laptop is MacOS 10.14.6 with 2.8 GHz Intel Core i7 and SSD.

spartucus commented 5 years ago

And here is a related reading: https://github.com/bitcoin-core/secp256k1/pull/290