Browse Source
turns out stdlib ord() is somewhat slow; also, only lookup data chars once benchmarked with: ``` import time import electrum from electrum.segwit_addr import bech32_decode electrum.constants.set_testnet() inv = "lntb4m1p00zfpppp597ely08ffhk8n3emeswukt0y3qfvt3sj3ufkhnaatlrswj2xvwuqsp5vu3ezu44ka8arvgda44yalysp3k3edlvg56cjkk5lvu4e4anmdssdq2v9ekgctnvscqzynxqyz5vq9qypqsqrzjqv8shunq4nda8mw2mpxhtz8v03wlgug7sln2yvqklxym35ayz3erqxct8vqqqcqqqqqqqqlgqqqqqqgq9qrzjqdxvvgt048y4htef7r63r4ha9kctz3d6l3za0053ahe597wgrkc4gxct8cqqqfsqqqqqqqlgqqqqqqgq9qrzjqwyx8nu2hygyvgc02cwdtvuxe0lcxz06qt3lpsldzcdr46my5epmjxct8vqqqdcqqqqqqqlgqqqqqqgq9qrzjqf56jn5txtqqtepnd0ahg0qg5m5mavfajsx403rem9wgu6rue0de7xct8vqqqtgqqqqqqqlgqqqq86qq9qrzjq027z73uyyl7fy8pkrpcn7x0el82pz3fw974p2052de4uz4j5lqqxx49tuqqqwgqqqqqqqqqqqqqqqqqpurzjqfj34n62wztqjxl59w4drxekg04rrrtf08mdestwhtky84ds7ja0yxct8sqqq3qqqqqqqqlgqqqqqqgq9qrzjqd872t5c5r5a8ssmwelpkdccsyn9mrr40rpp7khad4jr3kssxj9nvx49vgqqqnqqqqqqqqlgqqqq05qqgcxwu0ervh6atmqmqv7pmenhmc207gncyj0mcxedpwm8f56y2yl3qpq6mzjak37ddmeayd9unektmffv5rq8dvlpgq00rmmdalda73yhgqep0zuz" def f(): for _ in range(10000): addr = bech32_decode(inv, ignore_long_length=True) t0 = time.time() f() t1 = time.time() print(f"{t1-t0:.4f}") ```patch-4
SomberNight
4 years ago
1 changed files with 10 additions and 6 deletions
Loading…
Reference in new issue