cs: uncompress boot files

When the compression format changed to LZ4, which is much faster to
decompress than zlib, the configure script changed to enable
compression by default. Bytecode tends to benefit all around from
compression, but the boot files take 20ms or so longer to load --- not
a lot of time when loading typical amounts of code, but a signficiant
cost for a minimal startup. This commit allows compression to be
controlled separately for boot files, and it configures them as
uncompressed by default.
This commit is contained in:
Matthew Flatt 2019-05-23 13:13:16 -06:00
parent 7e0b893c01
commit 5896462e1a
3 changed files with 34 additions and 11 deletions

View File

@ -185,7 +185,7 @@ XPATCH =
XPATCHcross = --xpatch $(SCHEME_SRC)/$(TARGET_MACH)/s/xpatch
racket.boot: racket.so
$(SCHEME) --script $(srcdir)/convert-to-boot.ss @COMPRESS_COMP@ $(XPATCH@CROSS_MODE@) racket.so racket.boot $(TARGET_MACH)
$(SCHEME) --script $(srcdir)/convert-to-boot.ss @BOOT_COMPRESS_COMP@ $(XPATCH@CROSS_MODE@) racket.so racket.boot $(TARGET_MACH)
@INCLUDEDEP@ compiled/expander.d
@INCLUDEDEP@ compiled/thread.d
@ -200,10 +200,10 @@ racket.boot: racket.so
EMBED_DEPS = $(srcdir)/embed-boot.rkt
racketcs@NOT_OSX@@NOT_MINGW@: raw_racketcs petite-v.boot scheme-v.boot racket-v.boot $(EMBED_DEPS)
$(BOOTSTRAP_RACKET) $(srcdir)/embed-boot.rkt @ELF_COMP@ @COMPRESS_COMP@ raw_racketcs racketcs petite-v.boot scheme-v.boot racket-v.boot
$(BOOTSTRAP_RACKET) $(srcdir)/embed-boot.rkt @ELF_COMP@ @BOOT_COMPRESS_COMP@ raw_racketcs racketcs petite-v.boot scheme-v.boot racket-v.boot
gracketcs@NOT_OSX@@NOT_MINGW@: raw_gracketcs petite-v.boot scheme-v.boot racket-v.boot $(EMBED_DEPS)
$(BOOTSTRAP_RACKET) $(srcdir)/embed-boot.rkt @ELF_COMP@ @COMPRESS_COMP@ raw_gracketcs gracketcs petite-v.boot scheme-v.boot racket-v.boot
$(BOOTSTRAP_RACKET) $(srcdir)/embed-boot.rkt @ELF_COMP@ @BOOT_COMPRESS_COMP@ raw_gracketcs gracketcs petite-v.boot scheme-v.boot racket-v.boot
BOOT_OBJS = boot.o $(SCHEME_TARGET_INC)/kernel.o rktio/librktio.a
@ -214,13 +214,13 @@ raw_gracketcs: grmain.o boot.o $(BOOT_OBJS)
$(CC) $(CFLAGS) -o raw_gracketcs grmain.o $(BOOT_OBJS) $(LDFLAGS) $(LIBS)
petite-v.boot: $(SCHEME_TARGET_INC)/petite.boot
$(SCHEME) --script $(srcdir)/to-vfasl.ss @COMPRESS_COMP@ @TT_CROSS_MODE@ $(SCHEME_TARGET_INC)/petite.boot petite-v.boot
$(SCHEME) --script $(srcdir)/to-vfasl.ss @BOOT_COMPRESS_COMP@ @TT_CROSS_MODE@ $(SCHEME_TARGET_INC)/petite.boot petite-v.boot
scheme-v.boot: $(SCHEME_TARGET_INC)/scheme.boot
$(SCHEME) --script $(srcdir)/to-vfasl.ss @COMPRESS_COMP@ @TT_CROSS_MODE@ $(SCHEME_TARGET_INC)/scheme.boot scheme-v.boot petite
$(SCHEME) --script $(srcdir)/to-vfasl.ss @BOOT_COMPRESS_COMP@ @TT_CROSS_MODE@ $(SCHEME_TARGET_INC)/scheme.boot scheme-v.boot petite
racket-v.boot: racket.boot
$(SCHEME) --script $(srcdir)/to-vfasl.ss @COMPRESS_COMP@ @TT_CROSS_MODE@ racket.boot racket-v.boot petite scheme
$(SCHEME) --script $(srcdir)/to-vfasl.ss @BOOT_COMPRESS_COMP@ @TT_CROSS_MODE@ racket.boot racket-v.boot petite scheme
# ----------------------------------------
# Mac OS
@ -254,10 +254,10 @@ $(RKTFW): $(BOOT_OBJS) $(BOOT_FILES)
rm -f Racket.framework/Racket
ln -s Versions/$(FWVERSION)_CS/Racket Racket.framework/Racket
mkdir -p Racket.framework/Versions/$(FWVERSION)_CS/boot
$(SCHEME) --script $(srcdir)/to-vfasl.ss @COMPRESS_COMP@ @TT_CROSS_MODE@ $(SCHEME_TARGET_INC)/petite.boot $(FW_BOOT_DEST)/petite.boot
$(SCHEME) --script $(srcdir)/to-vfasl.ss @COMPRESS_COMP@ @TT_CROSS_MODE@ $(SCHEME_TARGET_INC)/scheme.boot $(FW_BOOT_DEST)/scheme.boot petite
$(SCHEME) --script $(srcdir)/to-vfasl.ss @COMPRESS_COMP@ @TT_CROSS_MODE@ racket.boot $(FW_BOOT_DEST)/racket.boot petite scheme
$(BOOTSTRAP_RACKET) $(srcdir)/adjust-compress.rkt @COMPRESS_COMP@ $(FW_BOOT_DEST)/petite.boot $(FW_BOOT_DEST)/scheme.boot $(FW_BOOT_DEST)/racket.boot
$(SCHEME) --script $(srcdir)/to-vfasl.ss @BOOT_COMPRESS_COMP@ @TT_CROSS_MODE@ $(SCHEME_TARGET_INC)/petite.boot $(FW_BOOT_DEST)/petite.boot
$(SCHEME) --script $(srcdir)/to-vfasl.ss @BOOT_COMPRESS_COMP@ @TT_CROSS_MODE@ $(SCHEME_TARGET_INC)/scheme.boot $(FW_BOOT_DEST)/scheme.boot petite
$(SCHEME) --script $(srcdir)/to-vfasl.ss @BOOT_COMPRESS_COMP@ @TT_CROSS_MODE@ racket.boot $(FW_BOOT_DEST)/racket.boot petite scheme
$(BOOTSTRAP_RACKET) $(srcdir)/adjust-compress.rkt @BOOT_COMPRESS_COMP@ $(FW_BOOT_DEST)/petite.boot $(FW_BOOT_DEST)/scheme.boot $(FW_BOOT_DEST)/racket.boot
# ----------------------------------------
# MinGW
@ -273,7 +273,7 @@ EXE_DESTS = ++exe raw_racketcs.exe RacketCS.exe ++exe raw_gracketcs.exe GRacketC
V_BOOTS = petite-v.boot scheme-v.boot racket-v.boot
RacketCS.exe GRacketCS.exe $(RKT_DLL): raw_libracketcs.dll raw_gracketcs.exe raw_racketcs.exe $(EMBED_DEPS) $(V_BOOTS)
$(BOOTSTRAP_RACKET) $(srcdir)/embed-boot.rkt --target $(TARGET_MACH) @COMPRESS_COMP@ $(EXE_DESTS) raw_libracketcs.dll $(RKT_DLL) $(V_BOOTS)
$(BOOTSTRAP_RACKET) $(srcdir)/embed-boot.rkt --target $(TARGET_MACH) @BOOT_COMPRESS_COMP@ $(EXE_DESTS) raw_libracketcs.dll $(RKT_DLL) $(V_BOOTS)
raw_racketcs.exe: main.o MemoryModule.o rres.o
$(CC) $(CFLAGS) -o raw_racketcs.exe main.o MemoryModule.o rres.o $(LDFLAGS)

View File

@ -637,6 +637,7 @@ SCHEME_CONFIG_ARGS
MAKE_BUILD_SCHEME
SCHEME_SRC
ELF_COMP
BOOT_COMPRESS_COMP
COMPRESS_COMP
CONFIGURE_RACKET_SO_COMPILE
NOT_MINGW
@ -764,6 +765,7 @@ enable_standalone
enable_pthread
enable_iconv
enable_compress
enable_compressboot
enable_origtree
enable_pkgscope
enable_docs
@ -1403,6 +1405,7 @@ Optional Features:
--enable-pthread link with pthreads (usually auto-enabled if needed)
--enable-iconv use iconv (usually auto-enabled)
--enable-compress compress compiled code (enabled by default)
--enable-compressboot compress boot files
--enable-origtree install with original directory structure
--enable-pkgscope=<s> set `raco pkg' default: installation, user, or shared
--enable-docs build docs on install (enabled by default)
@ -2323,6 +2326,11 @@ if test "${enable_compress+set}" = set; then :
enableval=$enable_compress;
fi
# Check whether --enable-compressboot was given.
if test "${enable_compressboot+set}" = set; then :
enableval=$enable_compressboot;
fi
# Check whether --enable-origtree was given.
if test "${enable_origtree+set}" = set; then :
@ -2521,6 +2529,7 @@ show_explicitly_set()
show_explicitly_enabled "${enable_pthread}" "pthreads"
show_explicitly_disabled "${enable_pthread}" "pthreads"
show_explicitly_disabled "${enable_compress}" "Compressed code"
show_explicitly_enabled "${enable_compressboot}" "Compressed boot files"
show_explicitly_enabled "${enable_xonx}" "Unix style"
show_explicitly_set "${enable_racket}" "Racket"
show_explicitly_set "${enable_scheme}" "Chez Scheme build directory"
@ -2828,6 +2837,7 @@ MINGW="not_mingw"
NOT_MINGW=""
CONFIGURE_RACKET_SO_COMPILE=""
COMPRESS_COMP=""
BOOT_COMPRESS_COMP=""
ELF_COMP=""
FRAMEWORK_INSTALL_DIR='$(libpltdir)'
@ -4167,6 +4177,10 @@ if test "${enable_compress}" != "no" ; then
COMPRESS_COMP="--compress"
fi
if test "${enable_compressboot}" = "yes" ; then
BOOT_COMPRESS_COMP="--compress"
fi
DIFF_MACH=skip
if test "${MACH}" != "${TARGET_MACH}" ; then
DIFF_MACH=
@ -5020,6 +5034,7 @@ CPPFLAGS="$CPPFLAGS $PREFLAGS"
makefiles="Makefile"

View File

@ -17,6 +17,7 @@ AC_ARG_ENABLE(standalone, [ --enable-standalone create a standalone shared
AC_ARG_ENABLE(pthread, [ --enable-pthread link with pthreads (usually auto-enabled if needed)])
AC_ARG_ENABLE(iconv, [ --enable-iconv use iconv (usually auto-enabled)])
AC_ARG_ENABLE(compress, [ --enable-compress compress compiled code (enabled by default)])
AC_ARG_ENABLE(compressboot, [ --enable-compressboot compress boot files])
m4_include(../ac/path_arg.m4)
AC_ARG_ENABLE(racket, [ --enable-racket=<path> use <path> as Racket to build; or "auto" to create])
AC_ARG_ENABLE(scheme, [ --enable-scheme=<path> Chez Scheme build directory at <path>])
@ -60,6 +61,7 @@ show_explicitly_set()
show_explicitly_enabled "${enable_pthread}" "pthreads"
show_explicitly_disabled "${enable_pthread}" "pthreads"
show_explicitly_disabled "${enable_compress}" "Compressed code"
show_explicitly_enabled "${enable_compressboot}" "Compressed boot files"
show_explicitly_enabled "${enable_xonx}" "Unix style"
show_explicitly_set "${enable_racket}" "Racket"
show_explicitly_set "${enable_scheme}" "Chez Scheme build directory"
@ -121,6 +123,7 @@ MINGW="not_mingw"
NOT_MINGW=""
CONFIGURE_RACKET_SO_COMPILE=""
COMPRESS_COMP=""
BOOT_COMPRESS_COMP=""
ELF_COMP=""
FRAMEWORK_INSTALL_DIR='$(libpltdir)'
@ -401,6 +404,10 @@ if test "${enable_compress}" != "no" ; then
COMPRESS_COMP="--compress"
fi
if test "${enable_compressboot}" = "yes" ; then
BOOT_COMPRESS_COMP="--compress"
fi
DIFF_MACH=skip
if test "${MACH}" != "${TARGET_MACH}" ; then
DIFF_MACH=
@ -631,6 +638,7 @@ AC_SUBST(MINGW)
AC_SUBST(NOT_MINGW)
AC_SUBST(CONFIGURE_RACKET_SO_COMPILE)
AC_SUBST(COMPRESS_COMP)
AC_SUBST(BOOT_COMPRESS_COMP)
AC_SUBST(ELF_COMP)
AC_SUBST(SCHEME_SRC)
AC_SUBST(MAKE_BUILD_SCHEME)