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

pkg/pillar: reduce test memory usage #4326

Merged

Conversation

christoph-zededa
Copy link
Contributor

apparently rand.Seed needs a bit of memory, so better not to call it all the time

Before:
mem-agentlog profile

After:
mem-agentlog profile

Copy link
Contributor

@europaul europaul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but also @OhmSpectator was trying to emulate memory pressure, so maybe high memory usage is very much in the sense of the test 😄

@christoph-zededa christoph-zededa changed the title pkg/pillar: reduce memory usage pkg/pillar: reduce test memory usage Oct 8, 2024
apparently rand.Seed needs a bit of memory, so better
not to call it all the time

Signed-off-by: Christoph Ostarek <[email protected]>
seed := time.Now().UnixNano()
r := rand.New(rand.NewSource(seed))
return r.Float64() * 100
return rand.Float64() * 100
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@christoph-zededa , out of curiosity, which seed rand will use in this case? It is going to use always the same seed or there is an initialization somewhere?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@OhmSpectator OhmSpectator merged commit 4357ccb into lf-edge:master Oct 9, 2024
54 of 65 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants