ZenGo-X / curv

Rust language general purpose elliptic curve cryptography.
MIT License
264 stars 111 forks source link

Adding global context secp256k1 #45

Closed elichai closed 5 years ago

elichai commented 5 years ago

This resolves #44

Before this for every multiplication you created the context. which is a very hungry operation (cpu, memory etc).

Instead we're creating a context only once and keep using that. this context is thread safe. you can pass it around however you want. the only constraint are:

There is no promise about the exact memory size and representation, meaning that you cannot save it to disk and reload later. no one should try and modify it's memory(not a problem in rust)

omershlo commented 5 years ago

@elichai Is the serde_json necessary? what is his purpose? @gbenattar can I merge?

elichai commented 5 years ago

It's used in the tests so I moved it from the dependencies to the dev-dependencies

omershlo commented 5 years ago

got it, thanks. @gbenattar waiting for your ok

gbenattar commented 5 years ago

I am approving this PR given the following pre-condition: