Opened 10 years ago

Closed 10 years ago

#1580 closed Enhancement (invalid)

Very small buffer for hash calculation

Reported by: jusid Owned by: charles
Priority: Normal Milestone:
Component: libtransmission Version: 1.40
Severity: Normal Keywords:
Cc: colrol@…

Description

I noticed that recalculateHash() function uses very small 8Kb input buffer. It is real speed killer on embedded devices with slow CPU like routers and NMTs.

Changing this buffer size to 64Kb produces 1.5x download speed boost on my NMT.

Change History (8)

comment:1 Changed 10 years ago by charles

  • Milestone changed from None Set to 1.41
  • Status changed from new to assigned

comment:2 Changed 10 years ago by charles

Added to trunk in r7338

comment:3 Changed 10 years ago by charles

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

Added to 1.4x in r7339

comment:4 Changed 10 years ago by jusid

  • Resolution fixed deleted
  • Status changed from closed to reopened

Charles, actually larger buffer helps reduce CPU usage on embedded devices by reducing the number of I/O calls to operating system.

In your changes you set only 16Kb for embedded devices and 64Kb for other systems. 64Kb buffer should be used for all systems.

comment:5 Changed 10 years ago by charles

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

good catch.

change added to trunk in r7343.

change added to 1.4x branch in r7344.

comment:6 Changed 10 years ago by jusid

  • Resolution fixed deleted
  • Status changed from closed to reopened

Charles, you changed buffer type from stack based to static. But recalculateHash() function is called from multiple threads! The results will be catastrophic if file verification will be performed by its thread and there will be active downloads.

comment:7 Changed 10 years ago by Rolcol

  • Cc colrol@… added

comment:8 Changed 10 years ago by charles

  • Milestone 1.41 deleted
  • Resolution set to invalid
  • Status changed from reopened to closed

the results will be catastrophic if I attempt to allocate a 64K array on the stack, too. That behaviour is not portable.

reverted in trunk in r7351.

reverted in 1.4x in r7350.

Note: See TracTickets for help on using tickets.