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

php-mode's call to php-syntax-propertize-function makes visiting large files rather slow #491

Open
phil-s opened this issue Dec 17, 2018 · 7 comments
Assignees

Comments

@phil-s
Copy link
Contributor

phil-s commented Dec 17, 2018

The size of file involved here makes this an edge case, but I have a 450K file of machine-generated PHP, and just opening the file on even a reasonably quick PC takes 3 seconds, which is mostly accounted for by that forced call to php-syntax-propertize-function at the end of php-mode:

 - php-mode                                 2208  92%
  - php-syntax-propertize-function          2080  87%
   - syntax-ppss                            1996  83%

Does anyone have ideas for how to circumvent or reduce that?

I can see that #294 introduced this call because Emacs 25 had ceased to do it automatically, which really makes me wonder whether there's an existing Better Way which Emacs 25 expects modes to be utilising?

NEWS.25 says:

** 'syntax-propertize' is now automatically called on-demand during forward parsing functions like 'forward-sexp'.

Which sounds like ideally this up-front effort wouldn't be needed at all; but presumably it turned out that it was in practice?

@phil-s phil-s changed the title php-syntax-propertize-function makes visiting large files rather slow php-mode's call to php-syntax-propertize-function makes visiting large files rather slow Dec 17, 2018
@mallt
Copy link
Contributor

mallt commented Dec 17, 2018

Good point! It seems this call was also removed from js-mode some time ago. I quickly tried to comment out the call locally, but then it seems larger files only get partially font locked, so I think more configuration will be needed to make this work.

@zonuexe zonuexe self-assigned this Dec 21, 2018
@bridgesense
Copy link

bridgesense commented Apr 19, 2019

I updated recently and I'm having to axe php-mode on relatively small files around 2600 lines of code.
I don't suppose there is a temporary hack someone would like to share?

Emacs 27.0.50

  • parse-partial-sexp 6670 78%
    • internal--syntax-propertize 6669 78%
      • syntax-propertize 6664 77%
        • php-syntax-propertize-function 6004 70%
          • syntax-ppss 5936 69%

@bridgesense
Copy link

Good point! It seems this call was also removed from js-mode some time ago. I quickly tried to comment out the call locally, but then it seems larger files only get partially font locked, so I think more configuration will be needed to make this work.

I took your suggestion and haven't noticed any partial font locking. In any case, it does make a tremendous speed difference. Thanks!

@mallt
Copy link
Contributor

mallt commented Apr 25, 2019

Ok great! I will give it some more testing to check if I still notice the partial font locking issue.

@mallt
Copy link
Contributor

mallt commented May 22, 2019

@phil-s @bridgesense This slowdown should be fixed by @zonuexe with PR #531. Could you perhaps verify this with the latest MELPA version of php-mode? Thanks!

@bridgesense
Copy link

Emacs: 27.0.50
php-mode: 20190522.1249

I loaded some of my larger projects. It works beautifully with no apparent issues.
Thank you!

@zonuexe
Copy link
Member

zonuexe commented May 23, 2019

@bridgesense Thanks!

I will release v1.21.3 tonight or tomorrow if there is no problem with this version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants