e3cf529f87
Measured on size of e main module (baseline is we don't embed it in application code): * embedding before: +16.5% uncompressed / +9.1% compressed * embedding with this CL: +4% uncompressed / +4.3% compressed When embeddeding deferred load list information into the app (as opposed to a separate json file) we now use a more compact encoding. Specifically: Instead of encoding it as an array of an array of strings (which are module names), we encode it as an array of an array of module ids and construct the module name from the id. To make the array of module ids more compact we utilize the fact that we can sort them and encode in delta encoding (i.e. instead of absolute module ids, encode the diff between previous module id in the list). We put the encoded module id lists in a data section and create `WasmArray<WasmI8>`s from them at startup. When we trigger a load we then decode them into the list of module names. There's more opportunity to optimize it, but it's good to do this as a first step. Change-Id: I293fb8879d992fc370786f6c9b258ccd27e1559b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/508980 Reviewed-by: Srujan Gaddam <srujzs@google.com> Commit-Queue: Martin Kustermann <kustermann@google.com>
38 lines
1.3 KiB
WebAssembly Text Format
38 lines
1.3 KiB
WebAssembly Text Format
(module $module5
|
|
(type $#Top <...>)
|
|
(type $BoxedInt <...>)
|
|
(type $JSExternWrapper <...>)
|
|
(type $Object <...>)
|
|
(global $"\")\"" (import "module0" "global4") (ref $JSExternWrapper))
|
|
(global $2 (import "module0" "global19") (ref $BoxedInt))
|
|
(table $module0.cross-module-funcs-0 (import "module0" "cross-module-funcs-0") 45 funcref)
|
|
(global $"\"foo2Code(\"" (ref $JSExternWrapper) <...>)
|
|
(global $FooConst2 (ref $Object)
|
|
(i32.const 111)
|
|
(i32.const 0)
|
|
(struct.new $Object))
|
|
(global $fooGlobal2 (mut (ref null $#Top))
|
|
(ref.null none))
|
|
(elem $module0.cross-module-funcs-0
|
|
(set 12 (ref.func $"foo2Code <noInline>"))
|
|
(set 37 (ref.func $0))
|
|
(set 38 (ref.func $1))
|
|
(set 42 (ref.func $2)))
|
|
(func $"foo2Code <noInline>" (param $var0 (ref null $#Top))
|
|
global.get $FooConst2
|
|
i32.const 18
|
|
call_indirect (param (ref null $#Top))
|
|
global.get $"\"foo2Code(\""
|
|
local.get $var0
|
|
global.get $"\")\""
|
|
i32.const 19
|
|
call_indirect (param (ref null $#Top) (ref null $#Top) (ref null $#Top)) (result (ref $JSExternWrapper))
|
|
i32.const 18
|
|
call_indirect (param (ref null $#Top))
|
|
global.get $2
|
|
global.set $fooGlobal2
|
|
)
|
|
(func $null (result (ref null $#Top)) <...>)
|
|
(func $null (param $var0 (ref null $#Top)) <...>)
|
|
(func $null (result (ref $Object)) <...>)
|
|
) |