Open twifkak opened 3 years ago
I was wrong about table[0]
. Useful output is available in a dev build, e.g.:
(cd cloudflare_worker; ~/.cache/.wrangler/wasm-pack-0.10.0/wasm-pack build --target no-modules --dev) && twiggy dominators cloudflare_worker/pkg/cloudflare_worker_bg.wasm | less
or likewise twiggy top
The wasm is reduced from 1.2 MB to 993 KB by removing disabling the pem parsing code
fn get_der(pem_text: &str, expected_tag: &str) -> Vec<u8> {
+ return vec![];
- for pem in ::pem::parse_many(pem_text) {
- if pem.tag == expected_tag {
- return pem.contents;
- }
- }
panic!("The PEM file does not contains the expected block");
}
We could find an alternative pem parser that takes less than 240 KB.
The compiled
cloudflare_worker
wasm is currently around 1.2MB. Theopt-level
andlto
tricks didn't reduce that. It's clearly possible to make small wasm binaries. Investigate the easiest change possible to make this one smaller.The
twiggy
command identifiedtable[0]
as the main culprit. I think that might have to do with the use of JS callbacks? Judging by the MDN article and Lin Clark's article.Things I didn't try:
format!
panic
no_main
no_std
Articles I didn't read: