tiny-secp256k1 icon indicating copy to clipboard operation
tiny-secp256k1 copied to clipboard

Two times speed regression between `2.2.2` and `2.2.3`

Open mahnunchik opened this issue 1 year ago • 3 comments

I've faced with the speed regression between version 2.2.2 and 2.2.3 for pointFromScalar method.

Simple test:

import * as secp256k1 from 'tiny-secp256k1';
import crypto from 'crypto';

const bufs = Array(10_000).fill(undefined).map(() => crypto.randomBytes(32));

for (const buf of bufs) {
  secp256k1.pointFromScalar(buf);
}
% time node tiny-222.js
node tiny-222.js  0,79s user 0,02s system 103% cpu 0,783 total
% time node tiny-223.js
node tiny-223.js  1,34s user 0,02s system 101% cpu 1,335 total

So at least pointFromScalar method became two times slower.

mahnunchik avatar Jul 17 '23 18:07 mahnunchik

Testing locally, #124

2.2.2
tiny-secp256k1 (WASM): 99.09 us/op (10091.34 op/s), ±1.19 %

2.2.3
tiny-secp256k1 (WASM): 176.99 us/op (5649.99 op/s), ±1.03 %

remove lowmemory (#124)
tiny-secp256k1 (WASM): 94.00 us/op (10638.65 op/s), ±1.37 %

junderw avatar Jul 18 '23 02:07 junderw

Please check if there are any other regressions you care about.

junderw avatar Jul 18 '23 02:07 junderw

  • pointAddScalar method has less regression 1,28s -> 1,58s
  • pointMultiply it shows slightly better performance on 2.2.3 1,49s -> 1,44s

mahnunchik avatar Jul 18 '23 18:07 mahnunchik