Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[utils][filecheck-lint]: speedup filecheck_lint#94191

Merged
bchetioui merged 2 commits intollvm:mainfrom
klensy:filecheck-lint-speedup
Jun 5, 2024
Merged

[utils][filecheck-lint]: speedup filecheck_lint#94191
bchetioui merged 2 commits intollvm:mainfrom
klensy:filecheck-lint-speedup

Conversation

@klensy
Copy link
Copy Markdown
Contributor

@klensy klensy commented Jun 3, 2024

For example:
clang\test\OpenMP\task_codegen.cpp: 0m29.570s -> 0m0.159s
clang\test\Driver: 4m55.917s -> 1m48.053s

Most win from big files.

@klensy klensy changed the title [utils][filecheck-lint]: speedup filecheck_lint by caching edit distance [utils][filecheck-lint]: speedup filecheck_lint Jun 3, 2024
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Jun 3, 2024

✅ With the latest revision this PR passed the Python code formatter.

@klensy klensy force-pushed the filecheck-lint-speedup branch from 01bd171 to 1a50a69 Compare June 3, 2024 15:05
@klensy
Copy link
Copy Markdown
Contributor Author

klensy commented Jun 4, 2024

cc @bchetioui

Actually, faster way is to use some external package to do fast levenshtein, like jellyfish (which speedup check to few seconds), but this is for separate commit.

Copy link
Copy Markdown
Member

@bchetioui bchetioui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @klensy for the improvement! A few small requests.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would you mind deriving your string here (and below) using the previous start_column and end_column logic?
These explain the expected behaviour better, imo.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you describe what you mean?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry---I was not clear. I meant to ask whether 7 could be assigned from len("junk// ") + 1 and 11 could be assigned from len(lines[1]) - 1.

I think this makes the expected behaviour clearer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like copypaste and not maintainable - change in input lines only will break tests without fixes here too.
Maybe add comment like:

junk; CHCK1:
      |   |
      |   column 11
      column 7

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like copypaste and not maintainable - change in input lines only will break tests without fixes here too.

The same tests will break in both cases.

Maybe add comment like:

Adding a comment here is strictly worse; that too will get out of sync, but will do so completely silently since the comment doesn't get executed.

Anyway, this is not a huge deal, and you seem to feel strongly about this, so let's keep it as is.

Comment thread llvm/utils/filecheck_lint/filecheck_lint.py Outdated
Comment thread llvm/utils/filecheck_lint/filecheck_lint.py Outdated
Comment thread llvm/utils/filecheck_lint/filecheck_lint.py Outdated
Comment thread llvm/utils/filecheck_lint/filecheck_lint.py Outdated
Comment thread llvm/utils/filecheck_lint/filecheck_lint.py Outdated
Comment thread llvm/utils/filecheck_lint/filecheck_lint.py Outdated
Comment thread llvm/utils/filecheck_lint/filecheck_lint.py Outdated
@bchetioui
Copy link
Copy Markdown
Member

cc @bchetioui

Actually, faster way is to use some external package to do fast levenshtein, like jellyfish (which speedup check to few seconds), but this is for separate commit.

That's a good point---there are certainly faster implementations of Levenshtein out there, but I don't think we'll want to add any non-standard third party dependency here. (Which is the reason we implemented a custom one here, even.) If you find one that we can use under these conditions, that'd be awesome!

@klensy klensy force-pushed the filecheck-lint-speedup branch from 1a50a69 to 32484a4 Compare June 4, 2024 13:44
@klensy klensy force-pushed the filecheck-lint-speedup branch from 32484a4 to fef05e9 Compare June 5, 2024 08:55
Copy link
Copy Markdown
Member

@bchetioui bchetioui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your contribution and addressing my comments @klensy!

@bchetioui bchetioui merged commit 42ebf3e into llvm:main Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants