News for hackers. Stuff that matters.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by flohofwoe on Thursday November 05, 2020 @07:23AM (#24997611)
Kinda hard to find actually working WASM showcases, but this one...

https://uado.platform.uno/

...loads 8.1 MBytes compressed (32 MBytes uncompressed) until the login button appears.

This simple calculator:

https://calculator.platform.uno/

...10.1 MBytes compressed, 53.8 MBytes uncompressed. Needs a splashscreen and 10 seconds to start (on a 50 MBit connection)

It's one thing to "simply" port some cross-platform-code to WASM and make it run in the browser, but making it a proper web application takes some actual effort. I feel that "efforts" like this just give WASM a bad reputation. Sorry to be blunt.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by jeswin on Thursday November 05, 2020 @08:09AM (#24997901)
I agree. IMHO Microsoft made a rather poor choice earlier by pushing Mono-based Ahead-of-time (AOT) compilation - when they should have thrown their weight behind CoreRT (now called native AOT). It looks like it's moving in the right direction now with native AOT [1]. Ability to target native code and WASM (without the baggage you mentioned above) with C# can give Go a run for its money.

1: https://github.com/dotnet/runtimelab/

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by csharptwdec19 on Thursday November 05, 2020 @10:41AM (#24999159)
I get why they did it to some extent, although I agree with the sentiment they didn't put enough weight behind CoreRT (Honestly I blame their cloud-centric view; the result is ASPNETCORE has been swarmed with developers while CoreRT has a few that also tend to have to work on the main runtime.)

BUT, putting Mono out there let everyone else in the community start developing tooling (that Microsoft will take the best ideas from before politely acting like the community didn't keep the whole idea afloat.)

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by zigzag312 on Thursday November 05, 2020 @02:27PM (#25001117)
+1 Trying to quickly build something based on Mono will probably result in a subpar solution, that they won't be able to really fix later on, because it would break backwards compatibility. End result will be half-fixed solution with some great technology, but with just enough underlying issues that will remain there forever. Classic Microsoft.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by kevingadd on Thursday November 05, 2020 @04:37PM (#25002276)
The strengths or weaknesses of CoreRT aside, it's a simple fact that Mono was ready and CoreRT was not. No number of strategic or tactical decisions will change whether a piece of software is ready to ship. Uno going all-in on CoreRT would have meant they shipped a working product later.

For context, the Blazor team started with their own interpreter compiled to WASM (via emscripten) instead of using either Mono or CoreRT - because shipping and getting user feedback is really important, and you can't do that while waiting for the ideal tech to be ready. It was swapped out later.

CoreRT is pretty cool tech but I rarely encounter anyone using it. Hopefully that will change in the future. The only CoreRT-based production app I know of is Streets of Rage 4 and it's a very recent release.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by zigzag312 on Friday November 06, 2020 @05:21AM (#25006559)
To be fair, CoreRT was an experimental project that was never officially released. So, it's not surprising you rarely encounter anyone using it. Issue is that it seemed like it's development never got allocated a serious amount of resources.

I agree that getting early user feedback is really important, but IMO it would be better if a limited version of Blazor WebAssembly (that would support only subset of .NET features, but have usable runtime size) was released on CoreRT tech and then slowly add more features. Blazor WebAssembly at it's current state, even though it supports all features, is too big to be really usable.

Spreading development resources thin between old tech like Mono and future tech just means future tech will be delayed even more. And when they figure out that in order to get the size down to a competitive levels, it would be better, if some features were kept out of the WebAssembly runtime (eg dropping reflection and relying on code generation instead), it will be too late, because it'll break compatibility with released Blazor WebAssembly projects.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by pjmlp on Friday November 06, 2020 @06:37AM (#25006894)
I really hope that they actually deliver proper AOT, specially now with the uncertain future for .NET Native.

Otherwise many devs will just look into alternatives (D, Go, Java (GraalVM)) even if that means lousing the benefits of the .NET eco-system.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by mycall on Thursday November 05, 2020 @08:03PM (#25003837)
It is planned to merge CoreCLR into .NET 6.0.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by jlaban-uno on Thursday November 05, 2020 @08:59AM (#24998234)
- Uno dev here

Fair comment.

Here are some other live Wasm apps examples: https://github.com/unoplatform/uno#live-webassembly-apps.

Note that .NET for WebAssembly is still in its early stages and the .NET team is likely to continue working on AOT compilation in the coming months, and the Uno team is going to help. This will be improving the payload size and performance that is currently very much lacking in that mode. Interpreted IL mode (the UADO app) is used where the AOT engine is not yet working properly, providing a base to get the framework itself progressing, while the infrastructure rest is improving.

Many of the .NET constructs are expecting exception handling (https://github.com/WebAssembly/exception-handling), which has to be emulated as it is not yet available in WebAssembly, adding significant code to the payload. Same for other features like null reference checking or indirect invocations (some may know more on that last one). Other features like lazy WebAssembly loading (for more than 4KB at least) and Interface Types to remove any Javascript (https://github.com/WebAssembly/interface-types/blob/master/p...) will also improve the actual and perceived performance significantly.

The immediate goal of the project is to provide the ability for new and existing C# apps (and not Web sites, not yet at least) to be available for non-walled garden environments. We expect the field to progress significantly in the coming years on many fronts, making this kind of apps more useful and viable.

Finally, you'll find that the Windows Calculator port to Uno is actually stretching thin the browsers resources because of the size of the Wasm payload (browser's memory and CPU is going really high because of the internal WebAssembly management). Yet, once the tiered compiler has cached the result, the load time goes down significantly.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by ComodoHacker on Thursday November 05, 2020 @09:04AM (#24998269)
I'd guess you'll be shipping precompiled essential .NET assemblies with Edge?
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by jlaban-uno on Thursday November 05, 2020 @09:15AM (#24998361)
That would be a question for the Edge and .NET team, but unfortunately that does not seem to be an option. The IL Linker (tree shaking) is removing unused parts of the binaries for the purpose of removing very large portions of code in the final binary. If binaries were to be bundled, or CDN hosted, we'd end up downloading extremely large unnecessary portions of code.

Yet, this simple fact that a WebAssembly app needs to download everything its needing to run puts it at disadvantage with Javascript (you download a browser with all the base libraries only once, and that's not lightweight).

For now, WebAssembly apps (in general and not just .NET ones) are more similar to mobile apps than websites, just because of this significant difference.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by greggman3 on Thursday November 05, 2020 @12:23PM (#25000007)
Just call into the browser to do any of those APIs and the problem is solved. The problem is you're taking your C# / .NET libraries for which solution already exist in the browser instead of building APIs around what already exists in the browser.

To put it another way, instead of starting with wrapped native apis and doing wasm last. Start with browser apis and make native ports of those, then you'll get something that works well in the browser and (95% of the time IMO) will work fine in your native version as well.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by lukevp on Thursday November 05, 2020 @12:26PM (#25000039)
Why don’t we push for first class wasm precaching in browsers? Right now wasm libs are limited in interop with JS and DOM. Could we have a .net/JVM like language-agnostic wasm standard lib bundled with all browsers, and target it like we do with .net standard? Then app makers could target a .wasm standard release and if the browser didn’t support it, polyfill in at app start the missing features?
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by Spivak on Thursday November 05, 2020 @01:04PM (#25000429)
“Please Update .NET to the latest version to access this website.”
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by emteycz on Friday November 06, 2020 @10:18AM (#25008183)
Surely you know that sites are chasing milliseconds as it has enormous influence on conversion rates?
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by JoshTriplett on Thursday November 05, 2020 @01:28PM (#25000609)
> Right now wasm libs are limited in interop with JS and DOM. Could we have a .net/JVM like language-agnostic wasm standard lib bundled with all browsers, and target it like we do with .net standard?

There's already a plan to give WebAssembly direct access to DOM, and to any other API JavaScript would have access to, without needing a JavaScript shim. (This requires integration between WebAssembly and the JavaScript garbage collector, which is part of why it's taking time to develop.)

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by ComodoHacker on Thursday November 05, 2020 @02:27PM (#25001125)
>language-agnostic wasm standard lib

Can such a thing even exist?

I think we'd better install wasm libraries (both language-specific and language-agnostic) like we install browser extensions.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by rictic on Thursday November 05, 2020 @04:46PM (#25002368)
> Can such a thing even exist?

Yes, cross-language code sharing is being worked on.

> I think we'd better install wasm libraries (both language-specific and language-agnostic) like we install browser extensions.

How would a site know what libraries are available? How would versioning work?

This is a caching problem, best solved at the normal browser resource cache level IMO.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by kevingadd on Thursday November 05, 2020 @04:40PM (#25002301)
For various reasons, doing anything like that in any browser is nearly impossible. One major obstacle is that CDN content cannot be cached cross-site anymore (by design, for security reasons) in any browser, and it would be a hard sell to compromise that anti-fingerprinting measure just to optimize load time for specific first-party WebAssembly code.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by madeofpalk on Thursday November 05, 2020 @07:56AM (#24997822)
While I definitely can't see this being useful for general websites/web applications, I guess I could see it being useful for "line of business" internal web apps for businesses?

But then, I don't understand why you wouldnt just make it with web tech to begin with and 'port' it to native platforms with Electron.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by baq on Thursday November 05, 2020 @08:36AM (#24998090)
because web tech isn't really the best solution for quick and dirty UIs.

source: been involved in quick and dirty UIs in a business for the past decade

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by SiVal on Thursday November 05, 2020 @08:53AM (#24998188)
So what has that decade taught you is the best solution for quick and dirty UIs?
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by qzw on Thursday November 05, 2020 @09:14AM (#24998354)
VisualBasic, back in the day.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by baq on Thursday November 05, 2020 @09:55AM (#24998743)
haven't found a universally good option yet; delphi was close 15 years ago, but the world forgot about it mostly. hoping for WASM+compiled language framework somewhat like this one to fit the bill so I don't have to worry about supporting multiple browsers, multiple browser versions, cross platform support, css...

WASM (language independence) on electron (fixed, controlled browser version) with delphi-like UI designer could work, maybe.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by acuozzo on Thursday November 05, 2020 @12:01PM (#24999820)
HyperCard.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by SenHeng on Thursday November 05, 2020 @10:35AM (#24999109)
PowerBuilder, in the EMR industry.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by 0x10c0fe11ce on Thursday November 05, 2020 @02:27PM (#25001118)
Beeware!
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by merb on Thursday November 05, 2020 @08:52AM (#24998186)
btw. one can also use blazor server-side for business line of applications, which is way more smooth and only needs websockets. so I have no idea which target c# client-side wasm (uno/blazor/whatever) has at the moment, because it simply is too big.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by kevingadd on Thursday November 05, 2020 @04:41PM (#25002321)
Historically, the companies with large line of business apps that were interested in using JSIL to run C# in the browser were interested specifically because rewriting their software from scratch in Electron was an expensive and time-consuming undertaking. This made it worthwhile to invest in alternatives that would let them reuse existing code. We're talking massive WPF or Silverlight codebases with decades worth of developer time invested that would all go out the window.

The same logic applies now and it's even more compelling since the tooling and performance are better now with the full LLVM WASM toolchain and more robust C# AOT compilation available, vs the dark ages when people had JSIL, Saltarelle and Bridge to choose from.

I'll also note that every major company I'm aware of that made a C# -> Browser move for their tooling eventually regretted it and started shifting away to something better, partly due to platform churn and partly due to how much was outside of their control. Electron may change the equation there enough to be good enough, we'll see - I don't know of any companies that have taken that route yet.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by Cthulhu_ on Thursday November 05, 2020 @10:26AM (#24999029)
So admittedly it's not as fast and compact as a 'native' web application (ironically), but zooming out a bit, how do you feel about it as a write once, run anywhere framework? I mean the webapp is a fallback for when you don't want to or cannot install one of the 'native' apps, which probably weigh in at similar sizes all things considered.

I don't think this is intended for public facing, low bandwidth/mobile websites.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by flohofwoe on Thursday November 05, 2020 @10:48AM (#24999230)
I think there's still a lot of room for improvement ;) For instance when you look at these demos:

https://floooh.github.io/sokol-html5/

These are also "write once, run anywhere" but with more focus on keeping the binary size small (both in WASM and for the native versions).

These demos start at 23 KBytes compressed and go to 537 KBytes compressed for the biggest UI sample (over half of those 537 KB is embedded TTF font data though).

At the same time, if I'd be using Qt instead of Dear ImGui to create the UI, the resulting WASM size probably would be similar to the UNO samples,

Writing cross-platform code that also works well on WASM really needs a different mindset from the ground up IMHO.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by jcelerier on Thursday November 05, 2020 @03:07PM (#25001476)
for some reason the text looks quite a bit more blurry and less readable than the same thing rendered with Qt on my machine. You should really consider using Freetype, Harfbuzz and friends, right now it looks like there is no hinting or something like that - see e.g. https://i.imgur.com/YgKFcd0.png

(yours top, Qt version bottom - I tried to match the font sizes visually but did not manage to decipher your code to find out exactly what they should be x) )

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by flohofwoe on Friday November 06, 2020 @03:54AM (#25006126)
Yeah, that's one downside of focusing on size alone, you'll have to make many compromises what to include and what to leave out. I'd love if browsers would have font- and text-rendering APIs that are low-level enough to integrate with WebGL/WebGPU.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by Jasper_ on Sunday November 08, 2020 @11:51AM (#25026964)
I have been planning to write one based around 2D canvas that uses pixel scanning and alignment properties to compute the metrics information that has been missing from the native APIs. Would allow a basic glyph atlas and layout, but I do wish had access to a glyph shaper directly....
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by greggman3 on Thursday November 05, 2020 @12:18PM (#24999970)
Further, going though gallery and clicking the stuff on the left column, each one takes 1/2 second to 2 seconds to respond. Maybe it's loading something over the net (too lazy to check) but it's not a good impression.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by azakai on Thursday November 05, 2020 @02:50PM (#25001316)
You're right that this is not optimized for the Web, but I also think there is a use case for this.

Sometimes you just want for code to be able to run at all, even with a sizable download, if it means you don't need to do any porting work. For example if you have many years of work on a codebase, and you can run it on the web with almost no effort, that can be really useful.

I agree that we want most things on the web to be optimized for the web. But sometimes business or other reasons matter more than code size.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by filleduchaos on Thursday November 05, 2020 @03:25PM (#25001610)
I'm genuinely struggling to think of a situation where users would be happy to sit through loading a _fifty megabyte_ web page but unwilling to just download a damn desktop app and be done with it.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by azakai on Thursday November 05, 2020 @03:46PM (#25001783)
Maybe many users would prefer a desktop app if they use it repeatedly, I agree. But if it's a website you just visit once, it's simpler and safer to just download 10MB of compressed data than to install an app.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by kevingadd on Thursday November 05, 2020 @04:46PM (#25002360)
Many people can't install an app. Period. "Can solve my problem after a 2 minute load time" vs "can't solve my problem" is a pretty easy decision to make.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by smoyer on Thursday November 05, 2020 @07:59AM (#24997835)
I've been playing with compiling Go into WASM for the last year. The size of the "binaries" created is entirely based on which libraries you include. Surprisingly, including the _fmt_ library adds about 2MBytes to the size of the code. Once you include the relatively few libraries you need, you can write a ton of code and the size of the code effectively stops growing.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by kodablah on Thursday November 05, 2020 @09:08AM (#24998303)
> Surprisingly, including the _fmt_ library adds about 2MBytes to the size of the code.

Part of including unicode package itself (transitively or otherwise) has a ton of package-level vars that bloat the WASM. Also, they slow down init because a bunch of code has to be run to initialize them. Also, due to the fact that WASM doesn't have arbitrary jumping, in order to support coroutine yielding and resumption, Go's WASM support puts big br_tables[0] at the top.

A while back, I brought up some efficiency concerns w/ data size and init instruction count[1] but they were dismissed as WASM concerns not Go ones and there weren't any easy/obvious wins. Also a while back, I used an interpreter to run the Go WASM up until actual main, then bake in the data that was initialized and remove init for packages where I didn't need their values[2]. I kinda gave up on using Go and WASM after all of that, but there is real room for improvement there.

0 - https://webassembly.github.io/spec/core/exec/instructions.ht...

1 - https://github.com/golang/go/issues/26622

2 - https://github.com/cretz/go-wasm-bake

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by smoyer on Thursday November 05, 2020 @11:16AM (#24999454)
That's some great insight! I just learned to avoid certain packages altogether and I've been living with the results. Precomputing init() is an interesting idea and I could see it both increasing or decreasing the resulting binary depending on what's in it (similar to how running LZW compression on an already compressed value will often create a larger result). Of course, you also need to consider the init() execution time and I've generally built my "main" application to load really fast and then load sub-applications as libraries in the background. Note that these are experiments and I don't have a major WASM-based UI in production.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by kevingadd on Thursday November 05, 2020 @04:48PM (#25002382)
Dependencies are the killer for webapps as a whole, and the general deficiency of web platform APIs is a big part of the problem. Want internationalization? Better compile ICU and ship 5+mb worth of code and data with every app, because the web platform is an absolute disaster for anyone who doesn't speak English. Want cryptography? Well, you can get it as long as you rewrite all your code to call out to JS and use async APIs for a synchronous operation. Want to decompress GZIP or Brotli? Time to compile those too and ship big blobs because the browser won't let you access its compression codecs either.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by sippeangelo on Thursday November 05, 2020 @10:00AM (#24998790)
This first example just gives me a pop-up saying "Download the application for a better experience" and sends me to the play store, and the second shows a distorted icon and never loads. Touché.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by oscargrouch on Thursday November 05, 2020 @12:24PM (#25000013)
I think thats because WASM were not meant to serve those cases.

I see WASM more as an "accelerator". The big chunk of code continues to be Javascript that can consume WASM modules.

I dont think this case of whole complex applications in WASM will fly. It looks like ActiveX 2.0 all over again.

Of course some things will happen as full apps in WASM, but they are mostly tools people already use outside of the Web, so that particular crowd just want to reach the tool, it doesnt matter the medium.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by qwerty456127 on Thursday November 05, 2020 @05:03PM (#25002548)
> This simple calculator … 53.8 MBytes uncompressed.

So it's no better than Electron? I'm primarily interested in the cross-platform desktop part.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by lostmsu on Friday November 06, 2020 @03:06AM (#25005919)
I understand this is th web version. If you build native, it is going to be smaller and faster.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by w0mbat on Thursday November 05, 2020 @07:14PM (#25003550)
It's a terrible calculator, quite apart from the ludicrous launch time. Just try driving it from the keyboard, which is how most people use calculators. Doesn't respond to enter, return is not mapped to equals, no key is mapped to CE or Clear. Did they even try using it?
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by tasogare on Thursday November 05, 2020 @07:38AM (#24997698)
The CLR and BLC provided a lot of services, of course this code taking some space. It’s totally a WASM problem since there is not other way to ship the C# runtime and libraries than downloading them each time. Exactly what plugins (Flash, Silverlight) were avoid...
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by flohofwoe on Thursday November 05, 2020 @07:46AM (#24997755)
IMHO the main problem is choosing a language which needs a big runtime in the first place. UNO seems to be at a point where the Unity game engine was about 5 years ago in their asm.js/WASM efforts. In the end they realized that it's impossible to get the .NET runtime small enough for the web (at least for typical C# code which uses common standard library features).

The way Unity solves this is by creating their own C# dialect, compiler and minimal runtime (without GC etc). Sort of a brute-force approach, but until the standard .NET ecosystem solves the bloat problem it would have been better to build on a different language ecosystem.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by kevingadd on Thursday November 05, 2020 @04:51PM (#25002426)
While you're correct that Unity "solved" the problem, you can't generalize their solution to things other than games. You end up needing a bunch of custom ecosystems for specific problems and when we're talking about enterprise, education, etc apps they often end up needing everything because sometimes you just end up with a massive Our Company's App that has 20 different responsibilities.

To put it another way: Adobe can ship Photoshop using Emscripten, and big companies can probably eventually ship their internal C# business apps using Uno or Blazor, but you're not going to ship either of those using Unity's stock approach without building out all of the platform APIs they stripped out and adding back runtime features that were removed. The decisions they made were perfect for games, but people building general-purpose platforms can't cut all those corners.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by gamblor956 on Thursday November 05, 2020 @07:40PM (#25003699)
Unity has supported the .Net Framework (using .Net 4x) for several years...

However, they do not guarantee that the APIs in the .Net framework will work on all platforms, as some of them are still Windows specific.

https://docs.unity3d.com/2019.1/Documentation/Manual/dotnetP...

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by gamblor956 on Thursday November 05, 2020 @07:38PM (#25003695)
Unity uses normal C#. They switched to using the Rosyln compiler several years ago. https://yadiyasheng.medium.com/confusing-threesome-in-unity-...

They do take the IL generated by Rosyln and convert it to executable code using their own custom transpiler.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by flohofwoe on Friday November 06, 2020 @03:43AM (#25006069)
I mean the new "DOTS" stuff: Burst compiler, the HPC# language dialect, new ECS, and "Project Tiny". All except Project Tiny is being built mainly to improve performance, but it also benefits the web as target platform.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by withinboredom on Thursday November 05, 2020 @08:26AM (#24998006)
This is basically the same thing that Android did with Java. I think it’s probably best to pick a productive language and solve the problem from there. Low level languages are rough to work with when compared to what you get from unity.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by madeofpalk on Thursday November 05, 2020 @07:46AM (#24997762)
Is this a "WASM" problem or is a "hey we decided to ship all of C# to the browser" problem?

I think this is a fine tradeoff for certain contexts and usages, but I don't think the general usecase for WASM is to build general web applications in C# and ship all of the CLR for things like gmail.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by flohofwoe on Thursday November 05, 2020 @07:52AM (#24997799)
There's some inherent overhead in a .NET runtime which will be hard to get rid of, like the garbage collector. In the end it probably comes down to .NET being "too dynamic", making it hard to identify and eliminate dead code. Also typical high-level C# code tends to use a lot of 'standard library' features, basically the opposite of the 'embedded coding mindset' needed for small WASM apps.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by jlaban-uno on Thursday November 05, 2020 @09:23AM (#24998448)
- Uno dev here

If anything, the BCL or common libraries are too "static", where some pieces of code reference statically all features available.

One great example is JSON.NET: That library has basically one big method that type-checks all possible inputs, making unconditionally reachable every dependency for all features of the library. In this case, JSON.NET pulls the XML reader, DataSets, and many huge libraries that are generally not needed. In Uno, we generally don't AOT those libraries and use the interpreter for that (otherwise the payload would explode).

Such libraries need to be changed to be configurable, and dynamically enable dependencies as per the user's needs.

Conversely, many pieces of code are excluded by configuration because of reflection uses, but the .NET team is improving that scenario (https://devblogs.microsoft.com/dotnet/performance-improvemen...) with attributes to tag dependencies and hint the linker.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by flohofwoe on Thursday November 05, 2020 @09:45AM (#24998670)
A similar problem exists in the C/C++ world: designing a library in a way that supports good dead-code-elimination isn't something that many library authors think about.

Interestingly plain C libraries often do this better than C++ libraries (e.g. too generous use of virtual-method-interfaces in C++ libraries, or making heavy use of C++ stdlib containers when simple C-style arrays would do as well).

The Unity engine also suffered from a similar problem: If you used a simple physics feature like a stabbing collision check somewhere in your code, the entire physics module was pulled in, even though the code needed for stabbing checks is only a few percent of that physics module.

This is why I'm a bit sceptical that improvements in the .NET "machinery" alone can solve this problem. You also need to restrict language features and select the right dependencies. This is a general problem, not just web-specific, it's just that reducing the output binary size typically isn't a high-priority problem outside the web.

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by kevingadd on Thursday November 05, 2020 @04:53PM (#25002446)
Yeah, as you point out C++ libraries are especially hard to do DCE on. If you want to ship ICU in the browser right now it is a very big blob that it's hard to perform DCE on because the vtables retain lots of unused code and every API depends on every other API. A lot of this stuff was designed in an era before anyone could have anticipated the size constraints that would apply in 2020.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by chabad360 on Thursday November 05, 2020 @07:49AM (#24997781)
I guess we'll just have to wait for WASM binaries to support dynamic linking, at which point we'll get services like "cdnwasm" or "wasmdelivr".
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by achn on Thursday November 05, 2020 @07:46AM (#24997751)
There are some big improvements in .net 5 that allow more granular linking and should help reduce solitary binary size, and that may trickle down to Mono and Wasm soon.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by reaperducer on Thursday November 05, 2020 @11:25AM (#24999523)
This simple calculator... Needs a splashscreen and 10 seconds to start (on a 50 MBit connection)

Consider yourself lucky. It doesn't do anything on my machine except show the splash screen.

macOS 10.15.6 / Safari 14.0

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by MarkyC4 on Thursday November 05, 2020 @11:19AM (#24999479)
uado isn't quite "pixel-perfect" on Firefox (82.0.2, Mac): https://i.imgur.com/EYFzTv3.png
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by MarkyC4 on Thursday November 05, 2020 @01:38PM (#25000696)
seems fixed now!
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by carldebilly on Thursday November 05, 2020 @02:54PM (#25001342)
It's a known bug with the caching of fonts. If you clear all your browser cache and restart it again, you'll see it once again.
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by andrekandre on Thursday November 05, 2020 @04:31PM (#25002212)
that calculator took 35 seconds to load on my ipad pro... not a great first impression (and the ui lag was quite noticable as well)
Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by jlaban-uno on Thursday November 05, 2020 @05:03PM (#25002556)
- Uno dev here

The Safari Support for large WebAssembly binaries is not particularly great at this point. We hope that the Safari team will improve the performance aspects of WebAssembly, but it does not seem to be a priority at this point (see the Wasm feature map here: https://webassembly.org/roadmap).

For the iPad, the iOS built version of the same app works lots better (https://apps.apple.com/us/app/uno-calculator/id1464736591).

Re:Uno: Single-Codebase for Windows, WebAssembly, iOS, macOS... by andrekandre on Tuesday November 10, 2020 @06:23PM (#25053476)
i see, thanks for the pointers, i guess apple doesnt have much incentive to speed up web assembly...