Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#2086 closed Enhancement (fixed)

JSON RPC messages can be 84% shorter, saving bandwidth and CPU

Reported by: charles Owned by: charles
Priority: Normal Milestone: 1.70
Component: Transmission Version: 1.61
Severity: Normal Keywords:
Cc:

Description (last modified by charles)

libtransmission's JSON/RPC messages use a lot more space than they need to. This wastes bandwidth and CPU cycles for deflate().

  1. The biggest waste is whitespace added to make the JSON human-readable. Our JSON config files need to be human-readable, but the the RPC messages don't.
  2. Floating point numbers are being sent through with more decimal places than any of our clients need
  3. As a special case, "0.00000000" happens very frequently. We should test for this and send the result as "0" instead.

Sample results (in bytes):

  • 742,547 (Baseline 1.61 JSON message)
  • 354,053 (Same message after removing whitespace)
  • 175,586 (...and changing "0.00000000" to "0"
  • 117,912 (...and after setting precision to 4 decimal places)

Final result: 84% SHORTER

Change History (5)

comment:1 Changed 12 years ago by charles

  • Milestone changed from None Set to 1.62
  • Owner set to charles
  • Status changed from new to assigned

r8414: optionally remove most whitespace

r8417: remove the rest of the whitespace. add the "0" special case. limit floating-point precision to four decimal places

comment:2 Changed 12 years ago by charles

  • Summary changed from JSON RPC messages should use less bandwidth and CPU to JSON RPC messages can be 84% shorter, saving bandwidth and CPU

comment:3 Changed 12 years ago by charles

  • Description modified (diff)

comment:4 Changed 12 years ago by charles

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

comment:5 Changed 12 years ago by charles

  • Milestone changed from 1.62 to 1.70

Looks like we're going straight from 1.61 to 1.70...

Note: See TracTickets for help on using tickets.