Hello all,
I just landed some changes [1] to how Web IDL dictionaries work to
reduce the amount of code we generate, compile, and ship for them.
Specifically:
1) Dictionaries no longer automatically get an Init method that takes a
JSON string or a ToJSON method that produces a string. Consumers who
need those can annotate the dictionary in the IDL with
[GenerateInitFromJSON] and [GenerateToJSON] respectively.
2) Dictionaries only automatically get code to convert a dictionary to a
JS object if the need for such code can be deduced from Web IDL that
uses the dictionary (e.g. if it's used as a return value). Consumers
who need to manually convert dictionaries to objects in C++ (using
ToJSValue) can annotate with [GenerateConversionToJS].
3) Dictionaries only automatically get code to initialize the dictionary
from a JS object if this can be deduced from Web IDL that uses the
dictionary (e.g. it's used as an argument). Consumers who need to
manually initialize dictionaries from JS objects can annotate with
[GenerateInit].
The need for manual annotations in various edge cases is a bit annoying,
but these changes reduce the size of our shipping (LTO and whatnot)
binaries by ~200KB and reduce the size of non-LTO binaries by 850KB or
so, all of this not counting debug symbols. Or put another way, we're
now compiling about 1% less C++ code than we used to.
-Boris
[1] https://bugzilla.mozilla.org/show_bug.cgi?id=1214364
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform