Closed shashkovdanil closed 6 years ago
@shashkovdanil can you test distribution and use NanoID performance benchmark to prove that we improve shortid?
@ai, OK.
@ai, shortid was improved 🚀
has flat distribution test:
has flat distribution shortid with nanoid
expect(received).toBeCloseTo(expected, precision)
Precision: 1-digit
Expected: 1
Received: 1.3898666666666666

has flat distribution shortid original
expect(received).toBeCloseTo(expected, precision)
Precision: 1-digit
Expected: 1
Received: 2.3356444444444446
Benchmark test:
nanoid 149,530 ops/sec
nanoid/generate 154,555 ops/sec
uuid/v4 148,375 ops/sec
shortid 12,988 ops/sec
nanoid 149,435 ops/sec
nanoid/generate 148,073 ops/sec
uuid/v4 152,058 ops/sec
shortid 14,737 ops/sec
@shashkovdanil in this test every symbol had different distribution, so you can't just show one number.
Post chars[k]
content instead.
Also performance reducing if not do great.
I improved performance:
shortid old 33,979 ops/sec
shortid new 82,404 ops/sec
Integrated nanoid for generating id