summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2023-01-29 09:08:41 +0100
committerRoland Reichwein <mail@reichwein.it>2023-01-29 09:08:41 +0100
commita9f5c6fbcca36eb7cc3a886714bc6477184eb8fa (patch)
tree9e221537790dedb390727308b228c12192c1b42c
parent4eedb599d8de5559daa4678c7520bb36968e767e (diff)
Minimize WASM size from ~1400000 to ~200000 bytes by explicit function export
-rw-r--r--webassembly/Makefile4
1 files changed, 3 insertions, 1 deletions
diff --git a/webassembly/Makefile b/webassembly/Makefile
index df81e19..49a5ed3 100644
--- a/webassembly/Makefile
+++ b/webassembly/Makefile
@@ -6,7 +6,9 @@ OBJS=diff.o
CXX=em++
CXXFLAGS=-I./include -O2 -std=c++20
-LDFLAGS=-s WASM=1 -s LINKABLE=1 -s EXPORT_ALL=1
+LDFLAGS=-s WASM=1 -s EXPORTED_FUNCTIONS=_diff_create,_diff_apply,_free
+# Note: Instead of the above explicit EXPORTED_FUNCTIONS, the following causes ~7x wasm file size:
+#-s LINKABLE=1 -s EXPORT_ALL=1
default: $(TARGET)