bugGNU nano - Bugs: bug #56433, [Task] nano should store each...

 
 

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

bug #56433: [Task] nano should store each compiled file-matching regex

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

Sat 24 Apr 2021 09:51:12 AM UTC, comment #4: 

Addressed in git, commit c96e62e3.

Benno Schulenberg <bens>
Group administrator
Wed 14 Apr 2021 10:48:07 AM UTC, comment #3: 

Well... when doing the comparison again (each over twenty runs) when opening just one small file (which is how most users will use nano), then memory usage is increased from 3600 to 3880 kB on average, and startup time reduced from 8.4 to 7.8 ms on average.  That's an eight percent increase in memory usage against a seven percent reduction in startup time.  That's not a clear-cut situation.  :|

Benno Schulenberg <bens>
Group administrator
Tue 16 Mar 2021 04:27:58 PM UTC, comment #2: 

When opening two files (the NEWS file plus a small file in which I store the memory usage -- running an automated '^T grep VmHWM /proc/$(pidof nano)/status' in that buffer and using --saveonexit), then storing all file-matching regexes (for all standard syntaxes) increases memory usage from roughly 4100 kB to 4200 kB, and reduces startup time from a minimum of 11.3 ms to a minimum of 9.7 ms.

So, using the attached patch, memory usage is increased by less than three percent whereas startup time is reduced by more than ten percent.  That looks like it's worth it.

(file #51075)

Benno Schulenberg <bens>
Group administrator
Wed 19 Jun 2019 06:38:28 AM UTC, comment #1: 

Brand posted a patch for this (file #47023) on bug #56432, but does not wish to see it applied, as it increases memory usage by some twelve percent (on his system).  If I remember well, this was one reason why I decided to discard the storing of these compiled regexes a long while ago.

Benno Schulenberg <bens>
Group administrator
Mon 03 Jun 2019 02:53:06 PM UTC, original submission:  

In grab_and_store(), each filename and headerline and magic regex is compiled to check its validity, but the result is discarded, which means that, when trying to match a file to a syntax, all these regexes have to be compiled again (until a match is found), again and again when opening multiple files.  This is a waste of time.  Better use some more mmemry and go faster.

Benno Schulenberg <bens>
Group administrator

 

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

Attached Files
file #51075:  save-regexes.patch added by bens (2KiB - text/x-patch)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -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 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-04-27 bens Open/ClosedOpen Closed
    2021-04-24 bens StatusNone Fixed
    2021-03-16 bens Attached File- Added save-regexes.patch, #51075
    2021-01-21 bens Assigned toNone bens

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code