-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature for disabling system randomness? #74
Comments
Hey Martin, I would be happy with such a feature — I expect it will just be a few However, I wonder if you would see any actual improvement in binary size. I went through an exercise recently to measure the binary size in my Textwrap crate. See the binary-sizes example. If you clone Textwrap and do $ cd examples/binary-sizes
$ cargo run --example make-table then you see the size of an example program using different feature flags. I would suggest you write a similar tiny program and compile it with and without the dependencies (you don't need to do the whole table thing, we can always look at that later if we want). My thesis is that it won't make a big difference: if you only call |
I ran a few of my own experiments. You are right, the impact on file size is negligible. However, another metric has turned out to be more interesting: compile time. I ran four compiles of each of the configurations in the table with a clean target directory using
(weirdly, release mode is faster here; the benchmarks were run on Debian Stretch, on WSL 2 in the mounted Windows file system, so disk I/O might be slow) With the In theory, this would also enable a version of this crate that is Do you think these compile time gains justify adding a new default feature? If yes, what do you think should be its name? (I called it |
It think this feature would be nice to have because right now the library does not compile to WebAssembly. You can work around the error by adding |
Hey both, I'm sorry for not looking at this sooner! It had slipped my mind. @reknih, thanks for actually testing it out! I'm personally not very upset about compile times in dependencies since I normally only compile them once per project. But I know that lots of people care about it :-) @laurmaedje, thanks, I had no idea that it could not compile for WebAssembly! That's something I would love to fix! @reknih, would you want to put up a PR with your changes? Then we can discuss names etc on that. |
Hi,
for my use case of
lipsum
, I exclusively call the..._from_seed
functions. Hence, I do not need the system-provided randomness throughrand::thread_rng
and the likes. Therand
crate collects its seeds through itsgetrandom
dependency.I'm a big fan of lean binaries so I wondered whether you'd be willing to create a feature for system randomness (enabled by default). This way, users like me could turn this feature off and drop not only
getrandom
but alsocfg_if
(transitively).Do you think this is a good idea, and if so, what should this feature be called? ("Randomness", "system-seeded", "getrandom" are a few examples coming to my mind.) I'd be happy to submit a PR.
The text was updated successfully, but these errors were encountered: