8 ms·
Why not statically compile and tree-shake? If this already exists why is it not effective?
by monadic2 6y ago
Why not statically compile and tree-shake? If this already exists why is it not effective?
- jayd16 6y agoBreaks reflection so I don't think its the most popular way. We're talking about saving how much disk space anyway?
- monadic2 6y agoWhat kind of behavior relies on reflection in C#? Is this widespread or isolatable? Is it necessary to use strings to look up symbols in C# or can you distinguish between strings and identifiers? > We're talking about saving how much disk space anyway? Surely this is relevant to how the customer values disk space, not the developer.
- eropple 6y ago> What kind of behavior relies on reflection in C#? Tons. Serialization, for one, And plugin systems are commonplace. > You have zero grounds to dictate the value of resources. Nonsense and worse words. We know how much disk costs. It is a rounding error for the overwhelming majority of people and the overwhelming majority of apps. Prioritize what matters.
- monadic2 6y ago> Serialization, for one Surely this is doable statically. What is the advantage of doing this at runtime rather than at compile time? > Nonsense and worse words. We know how much disk costs. It is a rounding error for the overwhelming majority of people and the overwhelming majority of apps. Prioritize what matters. Got a citation? Disk space is the only variable that people even know to complain about... Not sure what you're drawing this from but it stinks to high heaven of corporate propaganda.
- jyrkesh 6y agoHuh? I complain about RAM usage and garbage collection CPU time in my Electron apps just plenty. And those apps are huge too. I've never once needed to uninstall an application because I needed to reclaim the disk space. Just games and media files. If you're talking about the server side....well I think you'd save a lot more on less vCPU than a little more attached storage. So let me put it back on you: except maybe IoT, where do you run into problems where your app takes up too much disk space? EDIT: Maybe it's an update/bandwidth thing? Or a Docker pull time in CI? I'm trying to play devil's advocate here...
- monadic2 6y ago> I complain about RAM usage and garbage collection CPU time in my Electron apps just plenty. What does this have to do with C#? Surely you hold it to a higher standard than electron of all things—C# has been around for 18 years. Electron is just repackaging a browser as an app. Is this the standard to which microsoft holds themselves? Might as well sell scripts for google docs....
- tester34 6y ago>Got a citation? Disk space is the only variable that people even know to complain about... Not sure what you're drawing this from but it stinks to high heaven of corporate propaganda. I'm not sure where "Disk space is the only variable that people even know to complain about" did come from, but games use 100-150 GBs nowadays, so things like 17 MB are basically irrelevant unless you do verrrrrrrrry specific stuff
- monadic2 6y ago> I'm not sure where "Disk space is the only variable that people even know to complain about" did come from, but games use 100-150 GBs nowadays, so things like 17 MB are basically irrelevant unless you do verrrrrrrrry specific stuff If you have a phone with 8G of space like I do, obviously games which require 150G are beyond my means. How does this work towards disk space being irrelevant?
- cm2187 6y agoIsn't asp.net mvc also using relying massively on reflection?
- febstar 6y agoDownload size and speed matters. Disk space matters especially if you're working with relatively expensive SSDs. Of course, how much of a problem this is depends on which country you're working in, company's laptop policy etc
- entha_saava 6y agoBecause size is rounding error for your high-end hardware, I don't have any space left to install your app.
- fauigerzigerk 6y ago>We know how much disk costs. It is a rounding error for the overwhelming majority of people and the overwhelming majority of apps. We know how much disk costs, but at any given moment a certain non-negligible share of businesses will be working with very old equipment in some of their branch offices, self-service terminals, factory floors, labs, etc. I agree that 17 MB will rarely be a show stopper in isolation. But resource consumption is critical if Microsoft wants .NET to be a universal solution for business computing needs. Memory is far more likely to be the bottleneck in my experience. If a company has modern equipment in 95% of their locations, but the remaining 5% are difficult to upgrade for some reason (cost of disk is unlikely to be that reason), then those 5% will determine which technologies are even taken into consideration.
- JamesBarney 6y agoWidespread. Asp.net, entity framework, anytime you use an attribute, binding, autogenerating columns based on an object.
- bmm6o 6y agoRight. It's not that "normal" C# code uses a lot of reflection, but it's useful in a lot of small places. So the chances of any given program requiring at least some is pretty high.
- JamesBarney 6y agoYeah, I very rarely write reflection code (and 90% of the time its attribute related) but I can't remember the last time I worked on a non toy project that didn't leverage reflection somewhere.
- localhost 6y agoC# Source Generators [1] will help improve things considerably re: reflection. [1] https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/ https://devblogs.microsoft.com/dotnet/introducing-c-source-g...
- randombytes6869 6y agoUnfortunately I have doubts. This is one of the few features copied from Java instead of the other way around. You can pre-process code in Java and generate classes at build time instead of reflecting, but I know of just a handful of libraries that leverage this.
- SideburnsOfDoom 6y agoThey do tree-shake. It's mentioned in the demo linked here https://news.ycombinator.com/item?id=23256048 https://news.ycombinator.com/item?id=23256048
- randombytes6869 6y agoreflection. Same problem Java has. Too many libraries fiddling with the code at runtime. JS is also exposed to this. Some libraries can be shaken but I've always ran into random things breaking when trying it.