aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/profiling
diff options
context:
space:
mode:
Diffstat (limited to 'tools/profiling')
-rwxr-xr-xtools/profiling/ios_bin/binary_size.py (renamed from tools/profiling/ios_bin/binary_diff.py)42
1 files changed, 31 insertions, 11 deletions
diff --git a/tools/profiling/ios_bin/binary_diff.py b/tools/profiling/ios_bin/binary_size.py
index 6d5ae65e46..693b3c4d2e 100755
--- a/tools/profiling/ios_bin/binary_diff.py
+++ b/tools/profiling/ios_bin/binary_size.py
@@ -28,6 +28,9 @@ sys.path.append(
os.path.dirname(sys.argv[0]), '..', '..', 'run_tests', 'python_utils'))
import comment_on_pr
+# Only show diff 1KB or greater
+diff_threshold = 1000
+
size_labels = ('Core', 'ObjC', 'BoringSSL', 'Protobuf', 'Total')
argp = argparse.ArgumentParser(
@@ -104,22 +107,39 @@ for frameworks in [False, True]:
subprocess.check_call(['git', 'checkout', where_am_i])
subprocess.check_call(['git', 'submodule', 'update'])
- text += ('****************FRAMEWORKS*****************\n'
- if frameworks else '******************STATIC*******************\n')
+ text += ('***************FRAMEWORKS****************\n'
+ if frameworks else '*****************STATIC******************\n')
row_format = "{:>10}{:>15}{:>15}" + '\n'
text += row_format.format('New size', '', 'Old size')
- for i in range(0, len(size_labels)):
- if old_size == None:
- diff_sign = ' '
- elif new_size[i] == old_size[i]:
- diff_sign = ' (=)'
- elif new_size[i] > old_size[i]:
+ if old_size == None:
+ for i in range(0, len(size_labels)):
+ text += ('\n' if i == len(size_labels) - 1 else '') + row_format.format(
+ '{:,}'.format(new_size[i]), size_labels[i], '')
+ else:
+ has_diff = False
+ for i in range(0, len(size_labels) - 1):
+ if abs(new_size[i] - old_size[i]) < diff_threshold:
+ continue
+ if new_size[i] > old_size[i]:
+ diff_sign = ' (>)'
+ else:
+ diff_sign = ' (<)'
+ has_diff = True
+ text += row_format.format(
+ '{:,}'.format(new_size[i]), size_labels[i] + diff_sign,
+ '{:,}'.format(old_size[i]))
+ i = len(size_labels) - 1
+ if new_size[i] > old_size[i]:
diff_sign = ' (>)'
- else:
+ elif new_size[i] < old_size[i]:
diff_sign = ' (<)'
- text += ('\n' if i == len(size_labels) - 1 else '') + row_format.format(
+ else:
+ diff_sign = ' (=)'
+ text += ('\n' if has_diff else '') + row_format.format(
'{:,}'.format(new_size[i]), size_labels[i] + diff_sign,
- '{:,}'.format(old_size[i]) if old_size != None else '')
+ '{:,}'.format(old_size[i]))
+ if not has_diff:
+ text += '\n No significant differences in binary sizes\n'
text += '\n'
print text