Experiment in progress:. NET webassembly Support

Source: Internet
Author: User

At present, the four major browsers support webassembly by default, and the. NET community is also continuing to promote the ability of the. NET developers to compile their code into webassembly and then run it on the browser.

Webassembly is a binary web format designed to run near native performance applications that are not written in JavaScript language. Currently, C, C + +, and rust can be compiled into wasm format through a LLVM based tool chain. These languages are compiled into native code and can then be run without any additional code. Of course. NET usually requires a run-time platform to execute code, so it is theoretically feasible to use it in a browser, but it requires some extra work to make it run more efficiently.

One of the most likely projects to implement. NET Webassembly is the project that Steve Sanderson called Blazor, although it is still an ongoing experiment that is far from productive. Blazor on the Mono runtime platform, the runtime is compiled into WASDM format. NET code. At present, this results in a "Hello World" application load is larger than expected, Sanderson said:

Since migrating to the Mono runtime platform, new Blazor applications have become large (about 4MB). This is because the wasm on mono has not done any invalid code stripping and compression, and has packaged a very large run-time library. This run-time library includes many desktop-related features, but these features are web-agnostic. I expect a web-optimized production application that can be reduced to a size of nearly 300KB.

The mixed-compilation model for this project has been merged into the Mono project on November 1, 2017.

The other one might fit. net method, similar to the existing native code compilation method, that is, the static compilation combined into Wasm code. The code includes the mono C runtime platform and developer. NET code. As of this writing, a sample application using this method will download 10MB code to the user's computer. By contrast, loading the most recent twitter.com full page downloads more than 7MB of content, while visiting the nearest Amazon.com downloads 8.9MB of content. According to Miguel de Icaza, this size should be reduced over time:

Once we use a custom profile, this size should be significantly reduced. This customized profile is based on the mobile-side profile and removes a number of unnecessary features.

The project uses "LLVM experimental WEBASSEMBLY,LLVM connectors and binary tools to generate the final. Wasm code", but has not been updated in recent months.

In the official Corert library, there are also webassembly support prototypes.

Related articles:

Webassembly, the developer won.

webassembly: Sneak into the night with the wind

Mono's new interpreter

Original: Http://www.infoq.com/cn/news/2017/12/dotnet-webassembly-support

. NET community news, depth good text, welcome to visit the public number article summary http://www.csharpkit.com

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.