bugGNU nano - Bugs: bug #56432, [Task] nano shouldn't compile each...

 
 

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

bug #56432: [Task] nano shouldn't compile each color regex twice

Submitter:  Benno Schulenberg <bens>
Submitted:  Mon 03 Jun 2019 02:38:49 PM UTC
   
 
Severity:  1 - Wish Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Jump to the original submission

Wed 05 Jun 2019 10:32:16 AM UTC, comment #7: 

Pushed to master, commit 57b3f83c.  Thanks.

Benno Schulenberg <bens>
Group administrator
Tue 04 Jun 2019 08:45:32 PM UTC, comment #6: 

Looks good.

My startup time is a consistent 9-10ms, so a 5% change isn't measureable.

Brand Huntsman <brand>
Tue 04 Jun 2019 04:02:13 PM UTC, comment #5: 

Forgot to say: for my test case (opening four files, using only the standard syntaxes), startup time goes down from an average 42 ms to an average 40 ms.  (But the variation is something like -5 to +10 ms, so the speedup drowns mostly in the noise.)

Benno Schulenberg <bens>
Group administrator
Tue 04 Jun 2019 03:58:24 PM UTC, comment #4: 

Attached is a version that passes NULL to nregcomp() when the compiled regex should be discarded.

It also drops the rex_flags from the colortype struct, as they have become superfluous too.

Is this version okay with you?

(file #47028)

Benno Schulenberg <bens>
Group administrator
Tue 04 Jun 2019 03:43:27 PM UTC, comment #3: 

Attached is what I had yesterday, when I ran into bug #56434.  It's clumsy, with several allocations and frees.  Your version is more compact, but I don't like the extra boolean parameter.  I propose to pass NULL when the result of the compilation should not be kept -- it saves the declaring of a dummy variable in grab_and_store().  Coming up.

(file #47027)

Benno Schulenberg <bens>
Group administrator
Tue 04 Jun 2019 01:33:59 AM UTC, comment #2: 

The second patch was for testing purposes only and I do not approve of it, but forgot to remove the sign-off header before uploading. If you decide to apply it, please don't put my name anywhere on the commit.

Brand Huntsman <brand>
Tue 04 Jun 2019 12:58:15 AM UTC, comment #1: 

First patch fixes this but I saw no change in startup time, but maybe slower systems will. It did decrease memory by 35k because the regex strings are no longer stored.

The second patch fixes https://savannah.gnu.org/bugs/index.php?56433 and also didn't change startup time, but did increase memory by 400k (12%). That feature should not be implemented.

(file #47022, file #47023)

Brand Huntsman <brand>
Mon 03 Jun 2019 02:38:49 PM UTC, original submission:  

Currently, the regex of each color command of a syntax gets compiled (to check its validity) when the syntax gets parsed, and then gets compiled again when the syntax is activated.  Since commit cba9d8d0 from last month, these two things happen right after each other, so... doing the compilation twice is a pure waste of time.

Compilation of each should happen directly during parsing, and the result of this compilation should be stored immediately -- which means that the original regex does not need to be saved, which will save some space and a little time.

Benno Schulenberg <bens>
Group administrator

 

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

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by brand (Updated the item)
  • -email is unavailable- added by bens (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.

     

    Follow 8 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-06-19 bens Open/ClosedOpen Closed
    2019-06-05 bens StatusIn Progress Fixed
    2019-06-04 bens Attached File- Added 0001-rcfile-compile-the-color-regexes-just-once.patch, #47028
    2019-06-04 bens Attached File- Added compile-color-regexes-just-once.diff, #47027
    2019-06-04 brand Attached File- Added 0001-rcfile-only-compile-syntax-color-regexes-once.patch, #47022
        Attached File- Added 0002-rcfile-only-compile-syntax-header-and-magic-regexes-once.patch, #47023
    2019-06-03 bens StatusNone In Progress
        Assigned toNone bens

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code