Open Bug 1661689 Opened 5 years ago Updated 1 year ago

Add documentation on using bloaty to compare binary size of two revisions

Categories

(Firefox Build System :: General, task)

task

Tracking

(Not tracked)

People

(Reporter: sg, Unassigned)

References

Details

I have a script to compare two revisions with bloaty producing a nice report:

#!/bin/sh -eORIGINALREV=$(hg id --num)BASEREV=$1

function binary-lto-build() {
    MOZCONFIG=mozconfig.trace-lto ./mach build && cp -H obj-x86_64-pc-linux-gnu-optimized-lto/dist/bin/libxul.so libxul.so-r$(hg id --num)
}

NEWREV=$2
if [ "$NEWREV" == "" ] ; then
  NEWREV=$(hg id --num)
else
  hg up $NEWREV
fi
if [ "$NEWREV" == "$BASEREV" ] ; then
    echo "New and base revisions are the same: $NEWREV"
    exit 1
fi
echo "Comparing new revision $NEWREV against base revision $BASEREV"
if [ ! -f libxul.so-r$NEWREV ] ; then binary-lto-build ; fi
if [ ! -f libxul.so-r$BASEREV ] ; then hg up $BASEREV ; binary-lto-build ; fi
hg up $ORIGINALREV

echo "Base revision:"
hg log -l1 -r$BASEREV
echo "Changes measured:"
hg log -r $BASEREV:$NEWREV-$BASEREV --stat
bloaty $BLOATYOPTS libxul.so-r$NEWREV -- libxul.so-r$BASEREV

using this mozconfig:

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/obj-x86_64-pc-linux-gnu-optimized-lto
ac_add_options --disable-debug                                                 
ac_add_options --enable-optimize                                               
ac_add_options --enable-linker=lld
ac_add_options --enable-warnings-as-errors
ac_add_options --disable-hardening
ac_add_options --enable-lto=thin
AR=llvm-ar
RANLIB=llvm-ranlib
NM=llvm-nm

This could be added to the in-tree docs with some instructions for anyone interested.

Summary: Add documentation on using bloaty to analyze → Add documentation on using bloaty to compare two revisions
Summary: Add documentation on using bloaty to compare two revisions → Add documentation on using bloaty to compare binary size of two revisions

The bug assignee is inactive on Bugzilla, so the assignee is being reset.

Assignee: simon.giesecke → nobody
Status: ASSIGNED → NEW
See Also: → 1922272

After adding documentation, we could also consider actually running this as part of CI and fail the job if there are large regressions.

We already have the overall libxul size tracked for regressions, I don't think tracking bloaty regressions would add much value.

You need to log in before you can comment on or make changes to this bug.