Closed arnaud-ma closed 5 days ago
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
Attention: Patch coverage is 84.21053%
with 3 lines
in your changes missing coverage. Please review.
Project coverage is 93.10%. Comparing base (
c0d4b75
) to head (09cb610
). Report is 9 commits behind head on main.
Files with missing lines | Patch % | Lines |
---|---|---|
src/tap/utils.py | 82.35% | 3 Missing :warning: |
:exclamation: Your organization needs to install the Codecov GitHub app to enable full functionality.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Ah, the coverage diff is because the get_subsequent_assign_lines
and source_line_to_tokens
functions were not explicitly tested before. Now that they are no longer used in the code, it only shows up here
Feel free to remove code that is no longer used in the PR.
This is wonderful! Thank you for improving not only the performance, but also the code quality along the way. Much appreciated!
--JK
The most expensive thing (by far) in all the code is parsing the comments of the class variables, and in particular getting the source code of the classes with
inspect.getsource
andtokenize.generate_tokens
.I noticed 2 bottlenecks about this:
issubclass(Tap, Tap) is True
! This caused both functions to be called forTap
itself, which is quite large and so they had troubleinspect
side anyway, but it will always be better not to count on that. The idea is to replace theobj
parameter in each parsing function into what they really need (the tokens or the source code).Benchmark
Used ipython for the timeit
With a simple class like this:
Before:
After:
Of course, the bigger the class, the slower it will be:
It will always be slower than
argparse.ArgumentParser
:But it's quite close, i don't think it is an issue now.. as long as the class is small. I don't think that's enough to solve #42.