-
Notifications
You must be signed in to change notification settings - Fork 33
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
Lower integration tests memory usage #327
Conversation
49008af
to
7eb6764
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, the mechanism used to forward the cache settings into the algorithms that need it is not ok.
func MakeGossipDb(ctx *cli.Context, dbs kvdb.FullDBProducer, dataDir string, validatorMode bool, cacheRatio cachescale.Func) (*gossip.Store, error) {
This function already includes parameters deduced from the command line, additionally this is too late to parse command line arguments, ranges are not checked, and faulty values will be propagated to internal components for undefined behavior.
Please perform the command line arguments parsing the outermost possible layer of the program, sanitize arguments and return an error to the user as early as possible.
To avoid aliasing arguments into the program logic functions (like func x( bool, int , float ,int
) I propose alternatives:
- pack all configuration arguments from a function into a struct (this way you can add names to the funciton call side)
callFunction(configuration{
argument1: 1,
argument2: 2,
})
-
Pack single arguments into a struct (same effect, naming one argument at the time).
-
Use a builder pattern (may be a little too heavy for this use case).
0930f2c
to
e64997f
Compare
be318ff
to
d4be9bf
Compare
d4be9bf
to
e65e7cc
Compare
🥳 |
This PR lowers memory usage for fake net and integration tests by ~500 MB per test.
Before:
After:
part of https://github.com/Fantom-foundation/sonic-admin/issues/50