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

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

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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.
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>
Project AdministratorIn charge of this item.


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)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    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.6