Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf(runtime): fix strace regex #12220

Closed
wants to merge 4 commits into from
Closed

perf(runtime): fix strace regex #12220

wants to merge 4 commits into from

Conversation

fedemengo
Copy link
Contributor

@fedemengo fedemengo commented Apr 2, 2023

I think this regex can be simplified with no undesired effects.

When opening text file with long lines of numbers (bitstrings in my case) the additional and optional [0-9:.]* * put unnecessary work on the regex engine.

Honestly I don't see any reason why the regex should have the additional pattern. The two tests works fine with the simplified version

@fedemengo
Copy link
Contributor Author

@brammool do you see any value in this?

@brammool
Copy link
Contributor

brammool commented Apr 12, 2023 via email

@fedemengo
Copy link
Contributor Author

fedemengo commented Apr 13, 2023

@brammool I think that would definitely be better, however I'm not sure it's really required since the additional [0-9:.]* * is optional. It's not really changing the result of the simpler regex.

For example, with this config .vimrc

filetype on

a file with this line

execve()

it's already being recognised as strace type. This is the output after set ft=?

Screenshot 2023-04-13 at 18 40 05

That's why I was thinking we could either drop the [0-9:.]* * or we need to fix it up a bit. I think this regex used to be more specific at some point

https://github.com/vim/vim/blame/875feea6ce223462d55543735143d747dcaf4287/runtime/scripts.vim#L305

@brammool
Copy link
Contributor

brammool commented Apr 15, 2023 via email

@fedemengo
Copy link
Contributor Author

@brammool I changed the line as you suggested. I added a small test too. LMK if this works

@codecov
Copy link

codecov bot commented Apr 16, 2023

Codecov Report

Merging #12220 (2e65587) into master (cde8de0) will increase coverage by 0.00%.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master   #12220   +/-   ##
=======================================
  Coverage   81.95%   81.95%           
=======================================
  Files         164      164           
  Lines      194112   194142   +30     
  Branches    43831    43836    +5     
=======================================
+ Hits       159079   159117   +38     
+ Misses      22195    22193    -2     
+ Partials    12838    12832    -6     
Flag Coverage Δ
huge-clang-none 82.68% <ø> (+0.03%) ⬆️
huge-gcc-none 53.86% <ø> (+0.01%) ⬆️
huge-gcc-testgui 51.98% <ø> (+0.01%) ⬆️
huge-gcc-unittests 0.29% <ø> (ø)
linux 82.40% <ø> (-0.01%) ⬇️
mingw-x64-HUGE 76.55% <ø> (-0.01%) ⬇️
mingw-x86-HUGE 77.00% <ø> (-0.02%) ⬇️
windows 78.13% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 31 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

@fedemengo fedemengo changed the title perf(runtime): simplify strace regex perf(runtime): fix strace regex Apr 17, 2023
@brammool brammool closed this in 6e5a9f9 Apr 17, 2023
clason added a commit to clason/neovim that referenced this pull request Apr 18, 2023
Problem:    Strace filetype detection is expensive.
Solution:   Match with a cheap pattern first. (Federico Mengozzi,
            closes vim/vim#12220)

vim/vim@6e5a9f9

Co-authored-by: Federico Mengozzi <19249682+fedemengo@users.noreply.github.com>
clason added a commit to neovim/neovim that referenced this pull request Apr 19, 2023
Problem:    Strace filetype detection is expensive.
Solution:   Match with a cheap pattern first. (Federico Mengozzi,
            closes vim/vim#12220)

vim/vim@6e5a9f9

Co-authored-by: Federico Mengozzi <19249682+fedemengo@users.noreply.github.com>
craigmac pushed a commit to craigmac/vim that referenced this pull request Apr 22, 2023
Problem:    Strace filetype detection is expensive.
Solution:   Match with a cheap pattern first. (Federico Mengozzi,
            closes vim#12220)
github-actions bot pushed a commit to neovim/neovim that referenced this pull request May 10, 2023
Problem:    Strace filetype detection is expensive.
Solution:   Match with a cheap pattern first. (Federico Mengozzi,
            closes vim/vim#12220)

vim/vim@6e5a9f9

Co-authored-by: Federico Mengozzi <19249682+fedemengo@users.noreply.github.com>
(cherry picked from commit 9808866)
folke pushed a commit to folke/neovim that referenced this pull request May 22, 2023
)

Problem:    Strace filetype detection is expensive.
Solution:   Match with a cheap pattern first. (Federico Mengozzi,
            closes vim/vim#12220)

vim/vim@6e5a9f9

Co-authored-by: Federico Mengozzi <19249682+fedemengo@users.noreply.github.com>
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.

None yet

2 participants