patchGNU source-highlight - Patches: patch #10400, Add heuristic to handle long lines...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #10400: Add heuristic to handle long lines better

Submitter:  Tom de Vries <vries>
Submitted:  Wed 11 Oct 2023 07:24:23 AM UTC
   
 
Category:  None Priority:  5 - Normal
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open

Wed 11 Oct 2023 07:24:23 AM UTC, original submission:  

PR64747 describes a case where long lines in a c++ source file make
source-highlight run longer than 2m13s.

The problem is that some regexps are unanchored, and consequently run to the
end of the long lines.

Fix this by adding a heuristic that does the rule matching in two phases:
- anchored: add a "\\A[[:blank:]]*" prefix to the regexp.  If the rule
  matching yields a best-possible result, the next phase case be skipped.
- unanchored: use the regexp as is, be that anchored or unanchored.

This brings executing time down to 3s.

Written on top of commit e4cf32d ("Modernize configure.ac") due to PR64764
( https://savannah.gnu.org/bugs/?64764 ).

I've also added lines to all the touched files to specify file local variable
values for emacs to make editing less painful.

Tested on x86_64-linux.  Tested using:
- make check, and
- comparing output for the test-case with and without the patch.

Bug: https://savannah.gnu.org/bugs/?64747

Tom de Vries <vries>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by vries (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follows 1 latest change.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-10-11 vries Attached File- Added 0001-Add-heuristic-to-handle-long-lines-better.patch, #55227

    Back to the top

    Powered by Savane 3.14-f13d.
    Corresponding source code