wasi: optimizes args/environ parsing (#885)
While most compilers will only read args/environ once, tools like WAGI make heavy use of environment, possibly dozens of long variables. This optimizes both args and environ for this reason and also to setup for optimizing other functions. Here are the notable changes: * eagerly coerce to byte slices instead of strings * re-use null terminated length for writing values * avoid loops that call mem.WriteXXX internally Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
@@ -639,8 +639,8 @@ func requireSysContext(
|
||||
) *internalsys.Context {
|
||||
sysCtx, err := internalsys.NewContext(
|
||||
max,
|
||||
args,
|
||||
environ,
|
||||
toByteSlices(args),
|
||||
toByteSlices(environ),
|
||||
stdin,
|
||||
stdout,
|
||||
stderr,
|
||||
|
||||
Reference in New Issue
Block a user