aboutsummaryrefslogtreecommitdiffstats
path: root/benchmark/proto/compare_sizes.py
diff options
context:
space:
mode:
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())