Browse Source

[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
master
Glenn Strauss 10 months ago
parent
commit
5a694281da
  1. 2
      configure.ac
  2. 2
      src/CMakeLists.txt
  3. 4
      src/SConscript
  4. 8
      src/ls-hpack/lshpack.c
  5. 2
      src/ls-hpack/lshpack.h
  6. 4
      src/meson.build

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

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

4
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

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

2
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

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

Loading…
Cancel
Save