OCA / odoo-pre-commit-hooks

Linters of Odoo addons that complement pylint-odoo
GNU Affero General Public License v3.0
10 stars 12 forks source link

[REF] improve XPath expressions, compile them only once, fix false negative #79

Closed antonag32 closed 1 year ago

antonag32 commented 1 year ago

Added simple profiling test cases to get insights into the program flow and possible bottlenecks of the system. The profiling can be done on user-repositories with the following command:

PROFILING_TEST_REPO=path/to/repo tox -e cprofile


antonag32 commented 1 year ago

Initially I was just going to add cprofile tests to get a baseline idea of the state of the program. I don't think optimization is a priority right now but implementing the tests was simple and did not hurt.

I then found out XPath expressions could be compiled and used the approach out of curiosity to see if there were any perf improvements. My observations show a 5-10% improvement in program run time. During the POC I found out some xpath expressions could be improved to reduce the need for python processing and also fixed a false negative (I think) so I thought the changes were helpful enough to grant an MR.

Can you review @moylop260 @luisg123v

moylop260 commented 1 year ago

Interesting PR

FYI I had created a similar PR for Pylint a long time ago, but it was not merged:

Thank you!

@luisg123v

Could you review it, please?

luisg123v commented 1 year ago

@moylop260 It looks you didn't consider #78 as I commented on https://github.com/OCA/odoo-pre-commit-hooks/pull/78#pullrequestreview-1501379929

moylop260 commented 1 year ago

@moylop260 It looks you didn't consider #78 as I commented on #78 (review)

@antonag32 vas wey