Skip to content

Commit cae02f1

Browse files
committed
Speed LTO builds by using multiple threads
On my i5-1235U laptop this speeds LTO "partition=balanced" builds substantially, because each "partition" can be run on a separate CPU thread. I used "pygamer" as my test build with a parallelism of `-j4`, and took the best elapsed time reported over 4 builds. The improvement was from 34.6s to 24.0s (-30%). A link-only build (rm build-pygamer/firmware.elf; make -j...) improved from1 17.4s to 5.1s (-70%) The size of the resulting firmware is unchanged. Boards that are nearly full use "-flto-partition=one" to improve code size optimization. When LTO partition is "one", this feature doesn't help but it doesn't seem to negatively affect anything either (tested building trinket_m0)
1 parent 0aaf5a4 commit cae02f1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

py/circuitpy_defns.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ endif
7070
CIRCUITPY_LTO ?= 0
7171
CIRCUITPY_LTO_PARTITION ?= balanced
7272
ifeq ($(CIRCUITPY_LTO),1)
73-
CFLAGS += -flto -flto-partition=$(CIRCUITPY_LTO_PARTITION) -DCIRCUITPY_LTO=1
73+
CFLAGS += -flto=jobserver -flto-partition=$(CIRCUITPY_LTO_PARTITION) -DCIRCUITPY_LTO=1
7474
else
7575
CFLAGS += -DCIRCUITPY_LTO=0
7676
endif

0 commit comments

Comments
 (0)