core icon indicating copy to clipboard operation
core copied to clipboard

Do not call static constructor for instance methods

Open Jand42 opened this issue 7 years ago • 0 comments

Currently WebSharper.Json.Activate which is resolving RPC results does not check if the encoded value's type has a static constructor defined. So if a value of some type is sent over to the client as an RPC result, but no member of it has been accessed yet, the static constructor is not run. Similarly for Json.Deserialize.

To work around the absence of this, WebSharper currently generates calls for the static constructor for instance methods too. These extra calls would be unnecessary and gain some client-side performance and smaller compiled code if static constructors are called by these deseralizers.

Jand42 avatar Jan 05 '18 13:01 Jand42