Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1387 closed Enhancement (fixed)

Easy code changes to reduce CPU load

Reported by: charles Owned by: charles
Priority: High Milestone: 1.40
Component: libtransmission Version: 1.34
Severity: Normal Keywords:
Cc:

Description (last modified by charles)

There are a handful of easy speedups that softwareelves' Shark profiles are showing.

One is that we call time(NULL) a lot of times when we don't need to, and this adds up to about 6% total in the profiles.

The piece request validator in peer-mgr's refillPulse() and peer-msgs' AddRequest?() methods add up to 6.6% of the total, and are redundant to each other, so they can be folded together.

_tr_block() takes up 2.1% in refillPulse(), but can be removed.

tr_buildPath() is taking up a little over 3% by calling vsnprintf(). printf() is overkill here, since no string formatting is necessary -- we can simply malloc the path and memcpy the path fragments.

The biggie is the overhead being used to create the strings for tr_deepLog(). It's not very expensive in any place that it's called -- only a little over 1% in any given place -- but shows up in over a dozen places, so the cumulative footprint is large. We can avoid all of that by checking to see if deep logging is enabled before creating those strings.

Change History (7)

comment:1 Changed 12 years ago by charles

  • Status changed from new to assigned

Fixed in r6965, r6964, and r6961

comment:2 Changed 12 years ago by charles

  • Resolution set to fixed
  • Status changed from assigned to closed

comment:3 Changed 12 years ago by charles

  • Keywords backport-candidate added

comment:4 Changed 12 years ago by charles

  • Priority changed from Normal to High

comment:5 Changed 12 years ago by charles

  • Description modified (diff)

comment:6 Changed 12 years ago by charles

tr_buildPath() tweak added in r6981

comment:7 Changed 12 years ago by charles

  • Keywords backport-candidate removed
Note: See TracTickets for help on using tickets.