track currently active features while scanning#318
track currently active features while scanning#318wchristian merged 1 commit intoPerl-Critic:masterfrom
Conversation
|
I'll go over this later, but a quick question for now: What happens when the user uses any of these editing methods? https://metacpan.org/pod/PPI::Element#insert_before-@Elements |
|
@wchristian Honestly, I don't know. Presumably the same thing as before? But I can't tell what exactly these methods are supposed to do (or how they are supposed to interact with the tokenizer), anyway. I am reasonably sure that the documentation is wrong:
... because from looking at the code, you can insert multiple elements at once and there are no checks whatsoever. So I guess my answer is:
|
|
Perhaps a better answer: I hadn't thought much about structure-modifying methods like The added state is strictly in PPI::Lexer and PPI::Tokenizer (and the latter is "passive state", fully driven by the actions of PPI::Lexer). The modifications to PPI::Statement::Compound and PPI::Statement::Include by this patch reduce the number of redundant method calls (and in particular, calls to |
|
Thanks @mauke, and first off, sorry for being slow in responding, i'm currently at the other end of completing a 800km apartment move. Everything you said makes sense to me so far, and this particularly just being a speed-up of the initial parse and irrelevant after that's completed makes a lot of sense to me. I'll give it another read-through and release it on wednesday unless i find issues. :) Tho i would like you to answer the question i asked here: https://github.com/Perl-Critic/PPI/pull/318/files/1787646cb412874944cc4e282e546231f5f5a206#diff-f0b7cd24f2b8ce5ab36bffa5ad498650827118f17d0f8369d5633fd5a11944b2R131 because in general i don't mind changes for readability, but prefer feature commit changes to be limited only to making that feature happen. Can you please look at that? |
|
It isn't a change for readability. It eliminates unneeded calls to |
|
Aaaah, thanks. In that case i'll have to add a comment there. :) |
|
Any news on this issue? |
1787646 to
902422e
Compare
|
I have released a significant performance improvement from this branch as v1.286 : https://metacpan.org/dist/PPI There is more work to do in this branch, but everybody who is concerned, please install the new PPI and verify it against your codebases to see if your performance issues have been addressed at least partially. |
435fd2c to
02a908b
Compare
... instead of repeatedly scanning backwards for all feature enabling/disabling statements every time we need to know the current feature set. In my tests, this massively speeds up parsing of big documents/source files. Fixes Perl-Critic#309.
02a908b to
b24ad3b
Compare
|
I've cut another release: https://metacpan.org/release/MITHALDU/PPI-1.287 This includes the second performance increase, the feature parsing stack cache, as well as a number of other small changes from this branch, neatly sorted into individial commits. I also wrote a performance check script, which runs as part of the test suite, never fails, but prints human-readable output if things seem oddly slow. |
... instead of repeatedly scanning backwards for all feature enabling/disabling statements every time we need to know the current feature set. In my tests, this massively speeds up parsing of big documents/source files.
Fixes #309.
Demonstration:
With PPI 1.284:
With this patch: