Skip to content
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

prog: switch to math/rand/v2 #4751

Open
dvyukov opened this issue May 2, 2024 · 4 comments
Open

prog: switch to math/rand/v2 #4751

dvyukov opened this issue May 2, 2024 · 4 comments

Comments

@dvyukov
Copy link
Collaborator

dvyukov commented May 2, 2024

We extensively use math/rand, but there are some performance issues with it:
https://go.dev/blog/randv2

the Go 1 generator, which is reasonably fast (about 1.8ns per number on my
M3 Mac) but maintains an internal state of almost 5 kilobytes. In contrast,
Melissa O’Neill’s PCG family of generators generates better random numbers
in about 2.1ns per number with only 16 bytes of internal state.

Perhaps if we switch all pacakges (prog, fuzzer, etc) to math/rand/v2 we can get some perf wins.

It was added in Go 1.22, so need to fix #4746 first.

@a-nogikh
Copy link
Collaborator

a-nogikh commented May 8, 2024

If we stick to the rule that our old-env container uses a one older Go version than env/syzbot, we'd be able to make use of this new random generator only once Go 1.23 is released.

@dvyukov
Copy link
Collaborator Author

dvyukov commented May 8, 2024

We could diverge from that rule for a short period of time. Nobody really asked us for 2 versions.

Just spotted this:
https://twitter.com/val_deleplace/status/1787818710822011163

@tarasmadan
Copy link
Collaborator

What are the potential side effects assuming we want to remove syz-old-env?

@a-nogikh
Copy link
Collaborator

At the very least we want to make sure that newer syzkaller revisions are buildable and testable by the currently running syz-ci's in the current docker images. There's also FreeBSD (and probably something else), where we don't use docker containers at all, so we should be mindful of everything that breaks once we start using newer Go features. Otherwise, I can't think of any other benefits of the syz-old-env tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants