Skip to content

Commit f6ab5a1

Browse files
committed
ref(opt): use -0z and wasm-opt
1 parent 02754a2 commit f6ab5a1

4 files changed

Lines changed: 24 additions & 1 deletion

File tree

.github/workflows/preview.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@ jobs:
2626
with:
2727
deno-version: v2.x
2828

29+
- name: install binaryen
30+
run: sudo apt-get install -y binaryen
31+
2932
- name: build wasm
3033
run: make
3134

.github/workflows/publish.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ jobs:
2323
with:
2424
deno-version: v2.x
2525

26+
- name: install binaryen
27+
run: sudo apt-get install -y binaryen
28+
2629
- name: build wasm
2730
run: make
2831

@@ -52,6 +55,9 @@ jobs:
5255
with:
5356
deno-version: v2.x
5457

58+
- name: install binaryen
59+
run: sudo apt-get install -y binaryen
60+
5561
- name: build wasm
5662
run: make
5763

@@ -125,6 +131,9 @@ jobs:
125131
with:
126132
deno-version: v2.x
127133

134+
- name: install binaryen
135+
run: sudo apt-get install -y binaryen
136+
128137
- name: build wasm
129138
run: make
130139

.github/workflows/verify.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ jobs:
3737
- name: lint
3838
run: deno lint
3939

40+
- name: install binaryen
41+
run: sudo apt-get install -y binaryen
42+
4043
- name: build wasm
4144
run: make
4245

@@ -97,6 +100,9 @@ jobs:
97100
with:
98101
deno-version: v2.x
99102

103+
- name: install binaryen
104+
run: sudo apt-get install -y binaryen
105+
100106
- name: build wasm
101107
run: make
102108

@@ -126,6 +132,9 @@ jobs:
126132
with:
127133
node-version: 24
128134

135+
- name: install binaryen
136+
run: sudo apt-get install -y binaryen
137+
129138
- name: build wasm
130139
run: make
131140

Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
CC = clang
2+
WASM_OPT ?= wasm-opt
23
TARGET = clayterm.wasm
34
SRC = src/module.c
45

5-
CFLAGS = --target=wasm32 -nostdlib -O2 \
6+
CFLAGS = --target=wasm32 -nostdlib -Oz \
67
-ffunction-sections -fdata-sections \
78
-mbulk-memory \
89
-DCLAY_IMPLEMENTATION -DCLAY_WASM \
@@ -48,6 +49,7 @@ DEPS = $(wildcard src/*.c src/*.h)
4849

4950
$(TARGET): $(DEPS)
5051
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(SRC)
52+
$(WASM_OPT) -Oz --enable-bulk-memory -o $@ $@
5153

5254
wasm.ts: $(TARGET)
5355
deno run --allow-read --allow-write tasks/bundle-wasm.ts

0 commit comments

Comments
 (0)