Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

fix: sorting match positions ascending by force to avoid disorder#178

Merged
dajva merged 1 commit intodajva:masterfromeki3z:fix/sort-rg-match-positions
Oct 2, 2024

Conversation

eki3z
Copy link
Contributor

Sometimes, the variable rg-match-positions returns results in an unordered manner. Using nreverse alone is insufficient, so sorting in ascending order is applied explicitly.

@coveralls
Copy link

coveralls commentedOct 1, 2024
edited
Loading

Coverage Status

coverage: 83.144%. remained the same
when pulling61bd8a8 on liuyinz:fix/sort-rg-match-positions
intoe9ca15d on dajva:master.

@dajva
Copy link
Owner

dajva commentedOct 1, 2024
edited
Loading

So I assume this comes from multiple calls torg-filter, did you confirm the source of the problem?compilation-mode calls this repeatedly adding more content as it arrive so seems there could be a problem there.

I am meticulous with the performance of this code since I know this function is a hot spot. So, the usage ofcl-sort is a bit of a concern here, especially since it will be called for every invocation ofrg-filter and iterate over an increasingly larger list where most of the items should already be sorted. Did you benchmark this?

If my guess about the source of the problem is correct it should work, pushing the result to a local and then finish of with(nconc rg-match-positions (nreverse temp-list)) so that the new additions in every call torg-filter are appended to the existing list.
I assume this would be faster sincenconc is implemented in C and no comparisons with extra function calls need to be done. Can you investigate if this path should work just as well?

@eki3z
Copy link
ContributorAuthor

@dajva You are definitely right about that ! Due to multiple calls ofrg-filter,rg-match-positions need to be concated after every replacement rather than simplenreverse. I know little about elisp performance, very thankful for your patience and advice, is there any problem for latest code ? If you think it's OK, I would squash them into one commit.

@eki3zeki3zforce-pushed thefix/sort-rg-match-positions branch froma8ee75b toc4dfd94CompareOctober 2, 2024 07:20
@dajva
Copy link
Owner

It all looks fine now

@eki3zeki3zforce-pushed thefix/sort-rg-match-positions branch fromc4dfd94 to61bd8a8CompareOctober 2, 2024 13:18
@eki3z
Copy link
ContributorAuthor

Squash into one commit already, thanks for your review.

@dajvadajva merged commit0146c2a intodajva:masterOct 2, 2024
14 checks passed
@dajva
Copy link
Owner

Thanks a lot for the patch. Merged

@eki3zeki3z deleted the fix/sort-rg-match-positions branchOctober 2, 2024 21:07
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@eki3z@coveralls@dajva

[8]ページ先頭

©2009-2025 Movatter.jp