summaryrefslogtreecommitdiffstats
path: root/benchmark/proto/compare_sizes.py
diff options
context:
space:
mode:
authorChristopher Peplin <chris.peplin@rhubarbtech.com>2013-10-05 16:17:43 -0400
committerChristopher Peplin <chris.peplin@rhubarbtech.com>2014-01-07 13:18:09 -0500
commitb68150231d6f1a2608e2d33187e05d5d3bf4a5f1 (patch)
treeaba5d109eadaeafdb3ec9ef8f7f84da8f6975d11 /benchmark/proto/compare_sizes.py
parentc5f3b1fad0552f9f54970bfef25aa56c6795a8df (diff)
Remove timestamp from trace JSON before benchmarking - oops!
The size savings is now about 35%, not 55%.
Diffstat (limited to 'benchmark/proto/compare_sizes.py')
-rwxr-xr-xbenchmark/proto/compare_sizes.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/benchmark/proto/compare_sizes.py b/benchmark/proto/compare_sizes.py
index 5eee74cf..f31a2e4b 100755
--- a/benchmark/proto/compare_sizes.py
+++ b/benchmark/proto/compare_sizes.py
@@ -26,13 +26,15 @@ for trace_file in sys.argv[1:]:
except ValueError:
continue
+ del json_message['timestamp']
+
message = openxc_pb2.VehicleMessage()
if 'id' and 'data' in json_message:
# rough approx. that CAN messages are 10 bytes - they could be less
# but most of ours are full 64+11 bits
total_raw_can_size += 10
- total_raw_json_size += len(line)
+ total_raw_json_size += len(json.dumps(json_message))
binary_message = openxc_pb2.RawMessage()
binary_message.message_id = json_message['id']
binary_message.data = int(json_message['data'], 0)
@@ -48,7 +50,7 @@ for trace_file in sys.argv[1:]:
message.translated_message.numerical_value = json_message['value']
else:
message.translated_message.string_value = json_message['value']
- total_translated_json_size += len(line)
+ total_translated_json_size += len(json.dumps(json_message))
total_translated_binary_size += len(message.SerializeToString())