From 6f7cc11e6dd0f01b437fba893da2edd2362660a2 Mon Sep 17 00:00:00 2001 From: Dragan Dosen Date: Tue, 22 Dec 2020 14:46:47 +0100 Subject: [PATCH] MEDIUM: xxhash: use the XXH_INLINE_ALL macro to inline all functions This way we make all xxhash functions inline, with implementations being directly included within xxhash.h. Makefile is updated as well, since we don't need to compile and link xxhash.o anymore. Inlining should improve performance on small data inputs. --- Makefile | 2 +- include/haproxy/defaults.h | 7 +++++++ include/import/xxhash.h | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 95d52ca..6bfbbf9 100644 --- a/Makefile +++ b/Makefile @@ -847,7 +847,7 @@ OBJS += src/mux_h2.o src/mux_fcgi.o src/http_ana.o src/stream.o \ src/mworker-prog.o src/signal.o src/proto_udp.o src/lb_map.o \ src/sock_inet.o src/ev_select.o src/cfgparse-tcp.o \ src/action.o src/thread.o src/sha1.o src/ebmbtree.o \ - src/cfgparse-unix.o src/dict.o src/xxhash.o src/time.o \ + src/cfgparse-unix.o src/dict.o src/time.o \ src/hpack-dec.o src/arg.o src/hpack-tbl.o src/eb64tree.o \ src/chunk.o src/shctx.o src/regex.o src/fcgi.o src/eb32tree.o \ src/eb32sctree.o src/dynbuf.o src/pipe.o src/lru.o \ diff --git a/include/haproxy/defaults.h b/include/haproxy/defaults.h index ae4def1..6a8b03d 100644 --- a/include/haproxy/defaults.h +++ b/include/haproxy/defaults.h @@ -388,4 +388,11 @@ #define MAX_POLLERS 10 #endif +/* Make all xxhash functions inline, with implementations being directly + * included within xxhash.h. + */ +#ifndef XXH_INLINE_ALL +#define XXH_INLINE_ALL +#endif + #endif /* _HAPROXY_DEFAULTS_H */ diff --git a/include/import/xxhash.h b/include/import/xxhash.h index 2d56d23..074ad03 100644 --- a/include/import/xxhash.h +++ b/include/import/xxhash.h @@ -75,6 +75,8 @@ XXH32 6.8 GB/s 6.0 GB/s extern "C" { #endif +#include + /* **************************** * INLINE mode ******************************/ -- 1.7.10.4