warpnet / salt-lint

A command-line utility that checks for best practices in SaltStack.
https://salt-lint.readthedocs.io/en/latest/
MIT License
154 stars 39 forks source link

Update list() to [] and dict() to {} #134

Closed roaldnefs closed 4 years ago

roaldnefs commented 4 years ago

Update list() to [] and dict() to {} for performance improvement.

Fixes #132.

mjtrangoni commented 4 years ago

@roaldnefs just for fun, can you post here some performance information on this?

roaldnefs commented 4 years ago

The improvement isn't really noticeable. I did a couple of test runs on our own states, this are the fastest results.

The develop branch:

$ time find . -type f -name "*.sls" | xargs --no-run-if-empty salt-lint

real    0m0,336s
user    0m0,287s
sys 0m0,023s

And some test run on this branch:

$ time find . -type f -name "*.sls" | xargs --no-run-if-empty salt-lint

real    0m0,300s
user    0m0,281s
sys 0m0,018s
mjtrangoni commented 4 years ago

Ok, but I guess it is always faster. It could be more relevant if we add more checks.

roaldnefs commented 4 years ago

Ok, but I guess it is always faster. It could be more relevant if we add more checks.

Yes, and the existing code is also a good example for new contributors.