Opened 12 years ago

Closed 12 years ago

#3638 closed Enhancement (fixed)

fewer crypto calls when creating peer-ids, session-ids, announcer keys, etc

Reported by: charles Owned by: charles
Priority: Normal Milestone: 2.12
Component: libtransmission Version: 2.10
Severity: Normal Keywords:
Cc:

Description (last modified by charles)

tr_cryptoRandInt() is one of our most expensive API calls. When generating peer ids, session ids, and announcer keys, we make that call in a loop. These can be replaced with a call to tr_cryptoRandBuf() outside the loop. With this change we get N random bytes in 1 call rather than 4N random bytes spread across N calls. (The 4 is because tr_cryptoRandInt() gets fills an int with random bytes in each call.)

tr_cryptoRandBuf() is expensive too, but even so cachegrind indicates cuts about half of our RNG overhead in these sections of code.

Attachments (1)

fewer-crypto-calls.diff (3.0 KB) - added by charles 12 years ago.

Download all attachments as: .zip

Change History (4)

Changed 12 years ago by charles

comment:1 Changed 12 years ago by charles

  • Description modified (diff)

comment:2 Changed 12 years ago by charles

  • Component changed from Transmission to libtransmission
  • Owner set to charles
  • Status changed from new to assigned

comment:3 Changed 12 years ago by charles

  • Milestone changed from Sometime to 2.12
  • Resolution set to fixed
  • Status changed from assigned to closed

Added to trunk by r11333.

Note: See TracTickets for help on using tickets.