Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit adb788c

Browse files
authored
Use -Oz instead of -O2 to reduce compiled asset sizes significantly (#479)
* Run `npm ci` automatically after the devcontainer is created. This reduces the chance that another dev will forget to do this. * Upgrade to Emscripten 2.0.29 Changes required: * Defined EM_NODE_JS environment variable to get rid of a warning that appears if the NODE environment variable is set, but EM_NODE_JS is not. * EXTRA_EXPORTED_RUNTIME_METHODS is now EXPORTED_RUNTIME_METHODS * No longer pass the `-s LINKABLE=1` option to emcc when compiling. (This is a linktime setting and emcc warns about not using a linktime setting when compiling now). * Upgrade to Sqlite 3.36.0 Sqlite now publishes the hash as a SHA3 instead of SHA1, necessitating the installation of the sha3sum command. * Use -Oz optimizations instead of -O2 This reduces most compilation output by around 50%
1 parent 3f054c2 commit adb788c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

‎Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ EXTENSION_FUNCTIONS_SHA1 = c68fa706d6d9ff98608044c00212473f9c14892f
1717

1818
EMCC=emcc
1919

20-
CFLAGS = \
21-
-O2 \
20+
SQLITE_COMPILATION_FLAGS = \
21+
-Oz \
2222
-DSQLITE_OMIT_LOAD_EXTENSION \
2323
-DSQLITE_DISABLE_LFS \
2424
-DSQLITE_ENABLE_FTS3 \
@@ -53,7 +53,7 @@ EMFLAGS_WASM = \
5353

5454
EMFLAGS_OPTIMIZED= \
5555
-s INLINING_LIMIT=50 \
56-
-O3 \
56+
-Oz \
5757
-flto \
5858
--closure 1
5959

@@ -148,13 +148,13 @@ dist/worker.sql-wasm-debug.js: dist/sql-wasm-debug.js src/worker.js
148148
out/sqlite3.bc: sqlite-src/$(SQLITE_AMALGAMATION)
149149
mkdir -p out
150150
# Generate llvm bitcode
151-
$(EMCC) $(CFLAGS) -c sqlite-src/$(SQLITE_AMALGAMATION)/sqlite3.c -o $@
151+
$(EMCC) $(SQLITE_COMPILATION_FLAGS) -c sqlite-src/$(SQLITE_AMALGAMATION)/sqlite3.c -o $@
152152

153153
# Since the extension-functions.c includes other headers in the sqlite_amalgamation, we declare that this depends on more than just extension-functions.c
154154
out/extension-functions.bc: sqlite-src/$(SQLITE_AMALGAMATION)
155155
mkdir -p out
156156
# Generate llvm bitcode
157-
$(EMCC) $(CFLAGS) -c sqlite-src/$(SQLITE_AMALGAMATION)/extension-functions.c -o $@
157+
$(EMCC) $(SQLITE_COMPILATION_FLAGS) -c sqlite-src/$(SQLITE_AMALGAMATION)/extension-functions.c -o $@
158158

159159
# TODO: This target appears to be unused. If we re-instatate it, we'll need to add more files inside of the JS folder
160160
# module.tar.gz: test package.json AUTHORS README.md dist/sql-asm.js

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /