Enable link time optimization in the CLI.

One little compiler flag makes a surprisingly large difference:

api_call - wren            0.05s 0.0017 130.52% relative to baseline
api_foreign_method - wren  0.24s 0.0017 144.54% relative to baseline
binary_trees - wren        0.21s 0.0032 112.27% relative to baseline
binary_trees_gc - wren     0.75s 0.0288 115.02% relative to baseline
delta_blue - wren          0.13s 0.0031 103.24% relative to baseline
fib - wren                 0.20s 0.0036 120.56% relative to baseline
fibers - wren              0.04s 0.0007 108.52% relative to baseline
for - wren                 0.07s 0.0009 124.45% relative to baseline
method_call - wren         0.12s 0.0010  95.58% relative to baseline
map_numeric - wren         0.30s 0.0031 110.11% relative to baseline
map_string - wren          0.11s 0.0098 111.38% relative to baseline
string_equals - wren       0.19s 0.0064 115.49% relative to baseline
This commit is contained in:
Bob Nystrom
2016-01-20 07:47:00 -08:00
parent f9d1e9954a
commit 39b29ee07a

View File

@ -36,6 +36,7 @@ TEST_SOURCES := $(wildcard test/api/*.c)
BUILD_DIR := build
C_OPTIONS += -flto
C_WARNINGS := -Wall -Wextra -Werror -Wno-unused-parameter
# Wren uses callbacks heavily, so -Wunused-parameter is too painful to enable.
@ -142,7 +143,7 @@ bin/$(WREN): $(OPT_OBJECTS) $(CLI_OBJECTS) $(MODULE_OBJECTS) $(VM_OBJECTS) \
$(LIBUV)
@ printf "%10s %-30s %s\n" $(CC) $@ "$(C_OPTIONS)"
@ mkdir -p bin
@ $(CC) $(CFLAGS) $^ -o $@ -lm $(LIBUV_LIBS)
@ $(CC) $(CFLAGS) -fwhole-program $^ -o $@ -lm $(LIBUV_LIBS)
# Static library.
lib/lib$(WREN).a: $(OPT_OBJECTS) $(VM_OBJECTS)