Opened 3 years ago
Last modified 3 years ago
#2259 new enhancement
UDP Packet Pusher optimization 2
Reported by: | Zlatin Balevsky | Owned by: | zzz |
---|---|---|---|
Priority: | trivial | Milestone: | 0.9.36 |
Component: | router/transport | Version: | 0.9.34 |
Keywords: | ssu | Cc: | slumlord |
Parent Tickets: | Sensitive: | no |
Description
Another 12% of the CPU time spent in "UDP Packet Pusher" is spent traversing and the list of PeerState._outboundMessages in finishMessages(). This is because removing elements from an ArrayList is expensive and it happens a lot in that block of code (see attached YourKit snapshot).
I'll try replacing it with LinkedList, but there is a downside - that list is already a CachedIteratorArrayList which means it must have been identified as an allocation hotspot during earlier profiling. However, as it stands now "UDP Packet Pusher" is the thread using most CPU time so maybe it's a worthy tradeoff.
Subtickets
Attachments (1)
Change History (3)
Changed 3 years ago by
Attachment: | PeerState.png added |
---|
comment:1 Changed 3 years ago by
Milestone: | undecided → 0.9.36 |
---|
to be looked at mid-July after NTCP2 is checked in
comment:2 Changed 3 years ago by
Cc: | slumlord added |
---|
Changing to a LinkedList reduces the time spent in that method by a 3rd - to 8% of total thread time. However, as expected, hundreds of megabytes of garbage LinkedList$ListItr objects are created.
So it makes sense to implement a LinkedList with a cached Iterator.
Yourkit screenshot