You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In a performance profile in a downstream project I noticed txid() is taking too much time even considering it's an expensive computation, in the flame graph there were calls to secp function which I don't think should happen?
Can share the performance graph if can help understand
Ok, yeah, the issue is in libsecp256k1-zkp, not here. For some bizarre reason secp256k1_pedersen_commitment_serialize decompresses the point then recompresses it, when all it needs to do is a memcmp (I think). So this function is wasting a lot of time for no reason.
The next version of rust-bitcoin will break out the "types that never change" into a new primitives crate which should be sufficient for most of the other crates in the ecosystem, and which should rarely have major version bumps, which will make this all way less painful.
Activity
apoelstra commentedon May 9, 2024
Sure. What secp function was it?
RCasatta commentedon May 9, 2024
I had to leave the PC... I remember
fe_sqrtand others, will post tomorrowRCasatta commentedon May 10, 2024
Here are a convenient screenshot and the profiler json (to be loaded from chrome dev tools, performance tab)
For what I understand is how the PedersenCommitment is serialized with
secp256k1_pedersen_commitment_serializeTrace-20240510T085107.json
apoelstra commentedon May 10, 2024
Ok, yeah, the issue is in libsecp256k1-zkp, not here. For some bizarre reason
secp256k1_pedersen_commitment_serializedecompresses the point then recompresses it, when all it needs to do is a memcmp (I think). So this function is wasting a lot of time for no reason.RCasatta commentedon Jul 1, 2024
Issue has been fixed in the upstream lib, I think we need
apoelstra commentedon Jul 9, 2024
Bumping secp-zkp requires bumping secp, which requires bumping bitcoin, which requires bumping bitcoind, which requires bumping elementsd.
I am almost done this. Opened RCasatta/elementsd#18
apoelstra commentedon Jul 9, 2024
The next version of rust-bitcoin will break out the "types that never change" into a new
primitivescrate which should be sufficient for most of the other crates in the ecosystem, and which should rarely have major version bumps, which will make this all way less painful.RCasatta commentedon Sep 23, 2024
Fixed with #209
next release will take this