bugGNU nano - Bugs: bug #57090, [Task] optimize parse_mbchar() as...

 
 

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

bug #57090: [Task] optimize parse_mbchar() as it gets called lots of times

Submitter:  Benno Schulenberg <bens>
Submitted:  Sun 20 Oct 2019 05:18:37 PM UTC
   
 
Severity:  1 - Wish Status:  Fixed
Assigned to:  bens Open/Closed:  Closed

Thu 24 Oct 2019 03:34:38 PM UTC, comment #3: 

The speed of the two new routines has improved significantly.  Leaving things to settle for now.

Benno Schulenberg <bens>
Group administrator
Mon 21 Oct 2019 06:06:57 PM UTC, comment #2: 

Commit 3c695664 further optimizes the new advance_over() function, by eliding the call of is_cntrl_mbchar() and an 'if' for the plain ASCII case.

Eliding the call of is_cntrl_mbchar() for the UTF-8 case would be nice, because it could be a simpler version, but it would still duplicate some forty bytes of code.

Benno Schulenberg <bens>
Group administrator
Mon 21 Oct 2019 11:10:47 AM UTC, comment #1: 

Commit c2d8641f elides a NULL parameter (two machine instructions) and two unneeded ifs (four machine instructions).

With further reshuffling still more instructions can be eldided.  Will follow later.

Benno Schulenberg <bens>
Group administrator
Sun 20 Oct 2019 05:18:37 PM UTC, original submission:  

To see how often parse_mbchar() gets called, compile nano with gcc using the -pg option.  Then run:

  src/nano --ignore NEWS

and press ^V until reaching end-of-file, then press ^X.  Then run:

  gprof src/nano >list  &&  less list

See how parse_mbchar() and is_cntrl_mbchar() were called 240 thousand times.

Looking further down, all these calls of parse_mbchar() were made by either actual_x() or breadth().  Reducing the number of calls of these two functions would be good, but speeding up parse_mbchar() a bit will be an easy first step.

Benno Schulenberg <bens>
Group administrator

 

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

No files currently attached

 

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
    2019-10-24 bens StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2019-10-21 bens StatusIn Progress Ready For Test
    2019-10-21 bens StatusNone In Progress

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code