Change the client generated code to use the efficient compile time const Symbol generation for contract invocation function names when the function names are small enough.
Why
The client is intended to be a zero-cost abstraction when compared with invoking a contract with env.invoke_contract(cid, fn, args), but currently it is ~200 bytes more expensive in WASM size. This is because the generated client code is using runtime conversion from a &str to a Symbol for all symbols, even small ones that can be converted to a Symbol at compile time using const expressions.
This change reduces the size of contracts using a single short symbol by ~200 bytes.
What
Change the client generated code to use the efficient compile time const Symbol generation for contract invocation function names when the function names are small enough.
Why
The client is intended to be a zero-cost abstraction when compared with invoking a contract with
env.invoke_contract(cid, fn, args)
, but currently it is ~200 bytes more expensive in WASM size. This is because the generated client code is using runtime conversion from a &str to a Symbol for all symbols, even small ones that can be converted to a Symbol at compile time using const expressions.This change reduces the size of contracts using a single short symbol by ~200 bytes.
Close #1290