patchlwIP - A Lightweight TCP/IP stack - Patches: patch #8911, Optimize lwip_selscan()

 
 

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

patch #8911: Optimize lwip_selscan()

Submitter:  Joel Cunningham <jcunningham>
Submitted:  Wed 17 Feb 2016 10:43:51 PM UTC
   
 
Category:  sockets/netconn Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  jcunningham Open/Closed:  Closed
Planned Release:  None

Thu 18 Feb 2016 07:19:34 PM UTC, comment #4: 

Submitted, thanks

Joel Cunningham <jcunningham>
Group Member
Thu 18 Feb 2016 06:11:51 PM UTC, comment #3: 

I thought, you'd just push it... :-)

Simon Goldschmidt <goldsimon>
Group administrator
Thu 18 Feb 2016 03:16:05 PM UTC, comment #2: 

Thanks, I moved them so they aren't initialized every loop iteration.  Good call on moving to if(sock != NULL).  Patch 2 makes the suggested change

(file #36386)

Joel Cunningham <jcunningham>
Group Member
Thu 18 Feb 2016 10:05:31 AM UTC, comment #1: 

Nice improvement. Only I don't see why you moved the scope of the four variables out of the lop? Couldn't they even be moved into the "if(sock != NULL)" block?

Simon Goldschmidt <goldsimon>
Group administrator
Wed 17 Feb 2016 10:43:51 PM UTC, original submission:  

This patch makes a couple of simple re-arrangements in lwip_selscan() that
should improve performance in the following ways:

  1) The old code linearly walked all sockets to maxfd regardless of
     whether they were set in the fd set. The process involved
     acquiring sys arch protect, looking up the socket, and then
     checking if the socket was present in any of the fd sets. On
     systems with lots of sockets and a heavy SYS_ARCH_PROTECT
     infrastructure (a mutex) this can result in a lot of extra work.
     Now we skip this process for any fd that is not in the input sets
  2) If the socket from tryget_socket() is NULL we no longer continue
     and compare the input fd sets with a zeroed out set of events
  3) We no longer need to zero out our event sets because they are
     only accessed when tryget_socket() is successful

lwip_selscan() is called at most once per select call and sometimes up to three times

Joel Cunningham <jcunningham>
Group Member

 

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

Attached Files
file #36386:  0002-Optimize-lwip_selscan.patch added by jcunningham (4KiB - application/octet-stream)
file #36369:  0001-Optimize-lwip_selscan.patch added by jcunningham (5KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by jcunningham (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-02-23 goldsimon Open/ClosedOpen Closed
    2016-02-18 jcunningham StatusNone Done
        Assigned toNone jcunningham
    2016-02-18 jcunningham Attached File- Added 0002-Optimize-lwip_selscan.patch, #36386
    2016-02-17 jcunningham Attached File- Added 0001-Optimize-lwip_selscan.patch, #36369

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code