PlasmaPower / nano-vanity

A NANO vanity address generator (supports OpenCL)
BSD 2-Clause "Simplified" License
92 stars 31 forks source link

Add speed value to progress #20

Closed webmaster128 closed 6 years ago

webmaster128 commented 6 years ago

Shows the average speed in the progress allowing some benchmarking before the address is found:

Estimated attempts needed: 1048576
Tried 420178 keys (~40.07%; 2549.0 keys/s)

The speed value matches the time tool:

$ time ./target/debug/nano-vanity .simo
Estimated attempts needed: 1048576
Tried 1892494 keys (~180.48%; 2193.5 keys/s)
Found matching account!
Private Key: 08EE7A2C4207670F261BE5B7FDD2FFAAC4D831D1ECFF1EBB946C6A00C8BCEAE9
Account:     xrb_3simo47gd8b33q8iwr6u1i5r1mcgjrcgpzx6bistwww4m6d5wf68dxkxjicq
./target/debug/nano-vanity .simo  2104,48s user 14,30s system 245% cpu 14:22,91 total

14:22,91 total is 14*60+23 = 863 seconds. 1892494 keys / 863 s = 2192,9 / s, while time includes starting and ending the process.

PlasmaPower commented 6 years ago

Did you find the subsec_nanos to be necessary? Either way, I'd prefer to only call .elapsed() once. Rustfmt doesn't do this automatically since it's a macro, but I usually put a trailing comma for a multiline eprintln! invocation. Other than those small things, LGTM. Thanks!

webmaster128 commented 6 years ago

Thanks for feedback, will update

Did you find the subsec_nanos to be necessary?

I use it because second resolution was not sufficient. I got values jumping up and down like crazy in the first seconds which was not a nice user experience. I'd prefer to just use as_millis instead of as_seconds plus subsec_nanos but this is still experimental.

Either way, I'd prefer to only call .elapsed() once.

Good point. Since .elapsed() hides a call to now(), both second and nanosecond values come from different time.

I usually put a trailing comma for a multiline eprintln! invocation

Alright. I'm a trailing comma fan myself and very new to Rust.

webmaster128 commented 6 years ago

all updated. could you have another look?

PlasmaPower commented 6 years ago

Thanks! I'll push out a new crates.io release.