[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
This commit is contained in:
Glenn Strauss 2020-09-03 21:43:11 -04:00
parent 4656d91889
commit 5a694281da
6 changed files with 9 additions and 13 deletions

View File

@ -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])

View File

@ -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)

View File

@ -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

View File

@ -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>

View File

@ -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

View File

@ -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,
)