Add a WebAssembly version of System.Console. - #35555
Conversation
|
This has about half the size (linked) as the normal unix version (21k vs 45k). |
What accounts for the difference? |
|
All the not implemented methods plus the simplified error handling, i.e. Interop.GetExceptionForIoErrno () is not used. |
What keeps them linked in? Presumably the app isn't calling them. |
|
There is a huge amount of code which reads the terminal database. Some virtual methods like the Read() methods are also retained. |
Ok, thanks. I'm fine with this being merged, though I think it'd be good in the future for us to try to factor things in such a way that the linker could get rid of more, e.g. the terminal database, if it's not needed. It shouldn't be needed if the only thing the app is using is Console.ReadLine, for example. And it'd be nice if the size gains could accrue in the future to apps on other Unixes as well. cc: @eerhardt |
|
Tagging subscribers to this area: @eiriktsarpalis |
My understanding is the issue is the |
|
The terminal db code is being kept alive by: |
Isn't that Read small potatoes compared to the terminal db? |
My point wasn't specifically |
Understood, thanks. I'm highlighting that most of those overrides throw just like the one in this PR, they just throw a more appropriate exception that requires a tiny bit more logic to compute. So it doesn't look like we're saving a ton by having a custom ConsoleStream just for wasm; correct me if I'm wrong. The larger piece here seems to be the avoidance of the terminal db code, which ended up getting brought in per #35555 (comment) as part of 2ef9d36 |
No description provided.