6 ms·
I think a lot of it is you tend to only optimise as much as you need to. When the average user only has 4MB of memory, you're going to spend a lot of time optim
by seanwilson 9y ago
I think a lot of it is you tend to only optimise as much as you need to. When the average user only has 4MB of memory, you're going to spend a lot of time optimising image size for example. When you can assume 4GB of memory, you're going to put that time into other places as the effort would be very difficult to justify.
Wouldn't your users appreciate more features than optimisations most of them aren't going to notice? For the same block of time today compared to decades ago, you're going to be creating an app that uses more memory and CPU but has a lot more features. Developer time isn't free and needs to be justified.
I used to write DOS apps for 66MHz PCs and you'd spend an enormous amount of time optimising memory and CPU usage. This was similar for the initial batch of Android phones as well as you didn't get a lot of resources (e.g. loading a large image into memory would crash the app). Now I can create more features in way less time and rarely have to think about optimisations unless dealing with a lot of data.
I think expecting every software developer to release software that uses the absolute minimum amount of CPU and memory possible is completely unrealistic. The people commenting that developers don't know how to write optimised code anymore have different priorities to a typical business. I know how to make low level optimisations and have even resorted to assembly in the past but I'm only going to these lengths when it's absolutely required.
For commercial projects, it doesn't make any business sense to optimise more than is needed even if that makes software developers squirm.
- fauigerzigerk 9y agoYou are right, but the result of all apps (plus adverts) taken together is a very sluggish system. I think what operating systems should do is to allow users set per app/website quotas and use sensible defaults. Developers should get the message that no we can't use all the resources available on a given system just for our particular app.
- fredsir 9y agoThat would be a glorious feature. I wonder if QubesOS can do that. In any ways, macOS that I am running as my personal system probably ain't gonna get that feature anytime soon.
- seanwilson 9y ago> I think what operating systems should do is to allow users set per app/website quotas and use sensible defaults. I can't see how this would work. What would the sensible default be for a computer game? A text editor? An IDE? A video editor? This kind of thing is way over common users heads to set their own quotas as well. How would you avoid "This app wants to use more resources than the default. Allow?" popups with low defaults?
- fauigerzigerk 9y agoThe defaults would be set according to some simple statistics. If an app or website wants to use more it must ask for permission, but it can only ask a limited number of times within a given period. Of course it's easy to imagine an implementation of this idea that is annoying and confusing. But I can imagine this working very well and provide an incentive for developers to not waste resources.
- seanwilson 9y agoWhat statistics would you use though? My point was a high-end game is going to use close to 100% CPU all the time and lots of memory, a video editor is going to be idle sometimes and then try to use 100% CPU to make edits fast, text editors will be more modest etc. All apps have different resource usage profiles. I can't see how you could make this work without user interaction or a review process for apps.
- sacado2 9y ago"app XYZ seems to be using a lot of resources. Do you want to stop it ? Yes/No", with a "don't ask me again" checkbox.
- fauigerzigerk 9y agoOn second thought, I wouldn't actually use statistics at all. I would simply set all defaults to a low value in the single digits percentage range on average over a period of one minute or so. The overwhelming number of apps need next to no CPU (on average that is. Spikes are OK) during normal operation, and that includes text editors. Other applications, such as games, need all the juice they can possibly get. Users usually know why that is the case and will be happy to grant them that permission. There needs to be a way for an app to request a temporary suspension of resource limits, e.g. for running batch job that should finish as quickly as possible. Each website should be treated as a separate application and needs to compete for resources with the ads it runs. So there would be an incentive for website owners to keep the resource usage of ads in check.
- chriswarbo 9y agoWhilst this would be nice for power users (I've certainly hit out-of-memory on Linux and had random processed killed), it wouldn't have much effect in the grand scheme of things. Commercial developers will use as much memory as they can get away with; OS vendors would disable the quota system (or set the quota to 100% of whatever RAM the device has) since they don't want apps to "break" on their laptop/tablet/phone and work on their competitors'.
- jackmott 9y agoThere is some very basic education and industry choices we could make to get a ~4x or so efficiency gain without any substantive increase in development time/effort/maintance cost etc. If people graduated from college with just a little bit of understanding of how slow ram is, how CPU caches work, how expensive allocating memory on the heap is (either, initially with something like malloc, or amortized with garbage collection) and if we stopped using languages that haven't at least built a good JIT yet, and use AOT native compilation more often, we would all be in a much happier place. Systems would be much more snappy, or we could add more features, users can run more things at once before it goes to hell, batteries would last longer. None of this requires even changing what language you use, or massive changes in coding style. Just knowing some basic facts about how the computer works can let you choose the more efficient option among equivalently complex options -> "don't need a linked list here, let's use an array backed list instead" -> let's not use LINQ here because that allocates and this is a tight loop that runs on every request -> lets not use electron, let's build something with a similar external API that is more efficient
- seanwilson 9y agoWhy do you just assume apps using more resources now is because of coders with bad optimisation knowledge? > lets not use electron, let's build something with a similar external API that is more efficient People also choose Electron because it's an efficient in terms of development time to release apps on multiple platforms, not because they don't know how to optimise.
- 9y ago
- wolfgang42 9y ago> allow users set per app quotas This sounds sort of like what classic Macs did: there were some settings in the application's "Get Info" dialog to adjust the "current size" of the application (along with a note as to what the "preferred size" was); if there wasn't enough free memory the program would refuse to start. In practice, this is a terrible idea: it generally turned into "well, this program isn't working right, what if I fiddle with it's memory allocation?" and did nothing to actually help the user. (To be fair, the setting was necessary as a result of technical limitations, but I don't see it working out any better if it was implemented intentionally.)
- fauigerzigerk 9y ago>In practice, this is a terrible idea Perhaps it was in the 1980s, but back then applications didn't get funded by downloading adds from third parties using 100% of our CPU. We didn't use many applications at the same time either. So the problem we have right now simply didn't exist back then. And where it did exist, like on mainframes, they did actually use quota systems rather successfully I believe (just as we are right now with virtual machines).
- sametmax 9y agoThere is a huge different between not optimizing and giving decent perfs. Allowing video content, using images and a JS framework is alright. Not making sure the first load is under 1mo is, however, unprofessional. I get that some sites do need big pages: video tubes, big SPA, etc. But most sites are not youtube or facebook. If your blog post takes 3Mb to display text, it's doing it wrong.
- seanwilson 9y ago> There is a huge different between not optimizing and giving decent perfs. > If your blog post takes 3Mb to display text, it's doing it wrong. I agree if it's not much effort and it makes a big difference (e.g. to mobile users) you should make the optimisation. I'm more talking about people saying that instead of having one Electron app to support multiple platforms, a developer should be writing several native apps. The latter is a huge amount of development time to save a few 100MB of RAM that most users probably wouldn't notice anyway. Nice to have but it doesn't make business sense most of the time.
- sametmax 9y agoDepends for electron. First, 4 years old computers will feel the difference. Second, if your app is started a lot, the startup time will add up and be annoying. Third, if your app stays open a long time and you have several of them, they will end up eating from that 1Gb of RAM. It's really a bummer on low end computer. I got 32Gb of ram so I don't care, but my browser has 8. So if you have skype, chrome, thunderbird and an editor open, the new apps being electron or not will make a big difference.