mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-08-12 09:13:23 +00:00
Add optional PointScratch parameter to ECPoint.mul and ECPoint.mulG (default to scratch.get() for backward compat). All callers in Secp256k1.kt now pass their already-fetched scratch through. From the ECDH trace: ECPoint.mul was calling scratch.get() (ThreadLocal) redundantly — the caller already had the scratch. On ART, each ThreadLocal.get costs ~6µs (hash table probe), and ECDH had 10 calls totaling 64µs. With this change, all hot-path EC operations (verify, sign, ECDH, pubkey create, tweak mul) fetch the scratch once at the entry point and pass it through the entire call chain. https://claude.ai/code/session_015CtM5k88rF7WFgX8o2AGNR