Conversation
CodSpeed Instrumentation Performance ReportMerging #213 will degrade performances by 14.95%Comparing Summary
Benchmarks breakdown
|
420a424 to
b856085
Compare
Prior to this, the parsing behaved differently from the Python-based parsing in three ways: 1. The line contents only included up to the last matched token, meaning comments afterwards were excluded. 2. The type_checking conditional did not work for an alias of the `typing` module, e.g. `if t.TYPE_CHECKING`. 3. Non-ascii Python identifiers weren't supported. This commit fixes both of those.
b856085 to
567fd22
Compare
567fd22 to
a39e404
Compare
Peter554
reviewed
May 3, 2025
| } | ||
|
|
||
| @pytest.mark.xfail(strict=True) | ||
| def test_multiline_comment_a(self): |
Collaborator
There was a problem hiding this comment.
Peter554/pyimportparse@e7d3d0d might be an option
Collaborator
There was a problem hiding this comment.
On reflection, I think this might be a better approach -> #214
Peter554
reviewed
May 3, 2025
| pyimportparse = "0.2.1" | ||
| nom = "8.0.0" | ||
| nom_locate = "5.0.0" | ||
| nom-regex = "0.2.0" |
Collaborator
There was a problem hiding this comment.
nom-regex is not being used I think, so we could remove the dep?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces the use of Python's built in
astmodule with a custom Rust alternative.It is faster than
astprimarily because it is not a fully implemented Python parser, but just pulls out the imports.It's based on https://crates.io/crates/pyimportparse, but there were some aspects of it that were inconsistent with how Grimp currently behaves. So for the time being I've copied it in and adapted it.
It's likely that Astral will publish their Python parser as a crate - once that happens we may be able to move to that instead.