]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: rearrange target files by build time
authorWilly Tarreau <w@1wt.eu>
Sun, 11 Dec 2016 21:12:33 +0000 (22:12 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 12 Dec 2016 13:34:56 +0000 (14:34 +0100)
When doing a parallel build on multiple CPUs it's common that at the end
a few CPUs only are busy compiling very large files while the other ones
have finished. By placing the largest files first, we can ensure that in
the worst case they are present from the beginning to the end, and that
other processes are free to take smaller files. This ordering was made
based on a measurement consisting in counting the number of times a given
file appears in the build. The top ten looks like this :

    145 src/cfgparse.c
    131 src/proto_http.c
     83 src/ssl_sock.c
     74 src/stats.c
     73 src/stream.c
     55 src/flt_spoe.c
     48 src/server.c
     46 src/pattern.c
     43 src/checks.c
     42 src/flt_http_comp.c

Only a few files were moved, ssl_sock would need to be moved as well but
that would not be a convenient thing to do in the makefile. This new
order allows to save about 10-15% of build time on 4 CPUs, which is nice.

Makefile

index 8927919bbd7cf4e025cd42be414fdcb84100c137..9e3948501619462b750cc492c5dc1be8094368bd 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -765,20 +765,20 @@ else
 all: haproxy $(EXTRA)
 endif
 
-OBJS = src/haproxy.o src/base64.o src/protocol.o \
-       src/uri_auth.o src/standard.o src/buffer.o src/log.o src/task.o \
-       src/chunk.o src/channel.o src/listener.o src/lru.o src/xxhash.o \
-       src/time.o src/fd.o src/pipe.o src/regex.o src/cfgparse.o src/server.o \
-       src/checks.o src/queue.o src/frontend.o src/proxy.o src/peers.o \
-       src/arg.o src/stick_table.o src/proto_uxst.o src/connection.o \
-       src/proto_http.o src/raw_sock.o src/backend.o src/tcp_rules.o \
-       src/lb_chash.o src/lb_fwlc.o src/lb_fwrr.o src/lb_map.o src/lb_fas.o \
-       src/stream_interface.o src/stats.o src/proto_tcp.o src/applet.o \
-       src/session.o src/stream.o src/hdr_idx.o src/ev_select.o src/signal.o \
-       src/acl.o src/sample.o src/memory.o src/freq_ctr.o src/auth.o src/proto_udp.o \
-       src/compression.o src/payload.o src/hash.o src/pattern.o src/map.o \
-       src/namespace.o src/mailers.o src/dns.o src/vars.o src/filters.o \
-       src/flt_http_comp.o src/flt_trace.o src/flt_spoe.o src/cli.o
+OBJS = src/cfgparse.o src/proto_http.o src/stats.o src/server.o src/stream.o \
+       src/checks.o src/standard.o src/log.o src/flt_spoe.o src/stick_table.o \
+       src/peers.o src/pattern.o src/sample.o src/proto_tcp.o src/backend.o \
+       src/haproxy.o src/stream_interface.o src/tcp_rules.o src/proxy.o \
+       src/listener.o src/acl.o src/flt_http_comp.o src/filters.o src/dns.o \
+       src/cli.o src/flt_trace.o src/connection.o src/session.o src/vars.o \
+       src/map.o src/payload.o src/namespace.o src/compression.o \
+       src/mailers.o src/auth.o src/proto_udp.o src/memory.o src/freq_ctr.o \
+       src/signal.o src/uri_auth.o src/buffer.o src/task.o src/chunk.o \
+       src/channel.o src/lru.o src/xxhash.o src/time.o src/fd.o src/pipe.o \
+       src/regex.o src/queue.o src/frontend.o src/arg.o src/proto_uxst.o \
+       src/raw_sock.o src/lb_chash.o src/lb_fwlc.o src/lb_fwrr.o \
+       src/lb_fas.o src/applet.o src/hdr_idx.o src/ev_select.o src/hash.o \
+       src/lb_map.o src/base64.o src/protocol.o
 
 EBTREE_OBJS = $(EBTREE_DIR)/ebtree.o \
               $(EBTREE_DIR)/eb32tree.o $(EBTREE_DIR)/eb64tree.o \
@@ -801,7 +801,7 @@ DEP = $(INCLUDES) .build_opts
 # Used only to force a rebuild if some build options change
 .build_opts: $(shell rm -f .build_opts.new; echo \'$(TARGET) $(BUILD_OPTIONS) $(VERBOSE_CFLAGS)\' > .build_opts.new; if cmp -s .build_opts .build_opts.new; then rm -f .build_opts.new; else mv -f .build_opts.new .build_opts; fi)
 
-haproxy: $(OBJS) $(OPTIONS_OBJS) $(EBTREE_OBJS)
+haproxy: $(OPTIONS_OBJS) $(EBTREE_OBJS) $(OBJS)
        $(LD) $(LDFLAGS) -o $@ $^ $(LDOPTS)
 
 haproxy-systemd-wrapper: $(WRAPPER_OBJS)