diff options
author | Glenn Strauss <gstrauss@gluelogic.com> | 2020-09-03 21:43:11 -0400 |
---|---|---|
committer | Glenn Strauss <gstrauss@gluelogic.com> | 2020-10-11 12:19:26 -0400 |
commit | 5a694281da40d3fdcd402efb07edcb76f5808ceb (patch) | |
tree | 2e59cf3b72f2120753c7cc2bfaf2cc3c7f058b69 | |
parent | 4656d918897aca9875dcc20d49692a13f393090c (diff) | |
download | lighttpd-git-5a694281da40d3fdcd402efb07edcb76f5808ceb.tar.gz |
[core] ls-hpack optimizations
define LSHPACK_DEC_HTTP1X_OUTPUT 0
lighttpd does not require HTTP/1.1 output compat from HPACK decoder
("field-name: value\r\n")
define NDEBUG (in ls-hpack/lshpack.c)
lighttpd spends upwards of 20% total lighttpd CPU time in HPACK
encode/decode in h2load test on static file over cleartext (not TLS)
Defining NDEBUG eliminates some asserts() and results in a small
but measurable reduction in CPU usage
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/CMakeLists.txt | 2 | ||||
-rw-r--r-- | src/SConscript | 4 | ||||
-rw-r--r-- | src/ls-hpack/lshpack.c | 8 | ||||
-rw-r--r-- | src/ls-hpack/lshpack.h | 2 | ||||
-rw-r--r-- | src/meson.build | 4 |
6 files changed, 9 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac index df0d4c84..6c198d44 100644 --- a/configure.ac +++ b/configure.ac @@ -1588,8 +1588,6 @@ if test "$extrawarnings" = true || test "$extrawarnings" = error; then fi fi -AS_VAR_APPEND([CFLAGS], [" -DLS_HPACK_USE_LARGE_TABLES=0 -DXXH_HEADER_NAME=\\\"ls-hpack/deps/xxhash/xxhash.h\\\""]) - dnl build version-id LIGHTTPD_VERSION_ID=m4_format([0x%x%02x%02x], m4_unquote(m4_split(AC_PACKAGE_VERSION, [\.]))) AC_DEFINE_UNQUOTED([LIGHTTPD_VERSION_ID], [$LIGHTTPD_VERSION_ID], [lighttpd-version-id]) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 50acb445..d77251f7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -776,8 +776,6 @@ add_executable(lighttpd ${COMMON_SRC} ) set(L_INSTALL_TARGETS ${L_INSTALL_TARGETS} lighttpd) -add_target_properties(lighttpd COMPILE_FLAGS "-DLS_HPACK_USE_LARGE_TABLES=0") -add_target_properties(lighttpd COMPILE_FLAGS "-DXXH_HEADER_NAME=\\\\\"ls-hpack/deps/xxhash/xxhash.h\\\\\"") add_and_install_library(mod_access mod_access.c) add_and_install_library(mod_accesslog mod_accesslog.c) diff --git a/src/SConscript b/src/SConscript index 091ec0e7..398fc7e0 100644 --- a/src/SConscript +++ b/src/SConscript @@ -190,9 +190,7 @@ if env['with_nss']: if env['with_gnutls']: modules['mod_gnutls'] = { 'src' : [ 'mod_gnutls.c' ], 'lib' : [ env['LIBGNUTLS'] ] } -staticenv = env.Clone(CPPFLAGS=[ env['CPPFLAGS'], '-DLIGHTTPD_STATIC', - '-DLS_HPACK_USE_LARGE_TABLES=0', - '-DXXH_HEADER_NAME=\\"ls-hpack/deps/xxhash/xxhash.h\\"' ]) +staticenv = env.Clone(CPPFLAGS=[ env['CPPFLAGS'], '-DLIGHTTPD_STATIC' ]) ## all the core-sources + the modules staticsrc = src + common_src diff --git a/src/ls-hpack/lshpack.c b/src/ls-hpack/lshpack.c index 94bbfc47..d97cc55d 100644 --- a/src/ls-hpack/lshpack.c +++ b/src/ls-hpack/lshpack.c @@ -23,7 +23,13 @@ SOFTWARE. */ /*(lighttpd customization)*/ -/*#define NDEBUG*/ +#ifndef XXH_HEADER_NAME +#define XXH_HEADER_NAME "ls-hpack/deps/xxhash/xxhash.h" +#endif +#ifndef LS_HPACK_USE_LARGE_TABLES +#define LS_HPACK_USE_LARGE_TABLES 0 +#endif +#define NDEBUG #include <assert.h> #include <stdint.h> diff --git a/src/ls-hpack/lshpack.h b/src/ls-hpack/lshpack.h index 64e97035..cf46cd6d 100644 --- a/src/ls-hpack/lshpack.h +++ b/src/ls-hpack/lshpack.h @@ -42,7 +42,7 @@ extern "C" { /*(lighttpd customization)*/ /* decoder provides "field-name: value\r\n"; define to 0 to omit ": " and "\r\n" */ -/*#define LSHPACK_DEC_HTTP1X_OUTPUT 0*/ +#define LSHPACK_DEC_HTTP1X_OUTPUT 0 #ifndef LSHPACK_DEC_HTTP1X_OUTPUT #define LSHPACK_DEC_HTTP1X_OUTPUT 1 diff --git a/src/meson.build b/src/meson.build index 96322a22..6b2c40ee 100644 --- a/src/meson.build +++ b/src/meson.build @@ -788,10 +788,6 @@ executable('lighttpd', configparser, , libunwind , libws2_32 ], - c_args: [ - '-DLS_HPACK_USE_LARGE_TABLES=0', - '-DXXH_HEADER_NAME="ls-hpack/deps/xxhash/xxhash.h"' - ], install: true, install_dir: sbinddir, ) |