16 ms·
I only say this half-seriously, but that's why I sometimes think that part of any performance test should be "try to run your software on a Pentium 4". If it's
by Ieghaehia9 5y ago
I only say this half-seriously, but that's why I sometimes think that part of any performance test should be "try to run your software on a Pentium 4". If it's unusable, go back and optimize some more.
But it won't work now, because the whole stack is probably too inefficient.
- psyc 5y agoThe last time I was heavily into game development, I chose to develop only on a $350 laptop, for exactly that reason. The strategy really does work. The first time I ran it on a gaming machine was after it was done, and it ran like a dream.
- ludocode 5y agoI remember spending days trying to optimize some photo-scanning code in an app I was building and getting seriously frustrated with it. "This should be instantaneous!" Turns out I forgot / didn't notice I was running it under Valgrind the whole time. It was plenty fast once I ran it normally. There's another strategy for you :)
- bbarnett 5y agoIt'd be neat to have presets in kvm just for this.
- pdimitar 5y agoYour point is solid and I had the same philosophy for a while but I think we should draw the line of "minimum supported CPU" a bit further into the future for one simple reason: Ecology. A lot of the older computers were awfully power-inefficient (and also emit a lot of heat). So IMO we should replace "Pentium 4" in your statement with something like "Celeron J4115", or some of the Atom CPUs, maybe?
- pjmlp 5y agoMany of those older computers are the first computer of someone around the globe still, at least as long as they keep working.
- pdimitar 5y agoSure, not contesting this, but I meant my comment more along the lines of: If I am to gauge my app's speed on an anemic hardware I'd prefer running it on a modern Atom or Celeron because (a) indeed they're anemic but (b) at least are more eco-friendly.
- kergonath 5y agoDo you include the cost of manufacturing in your calculations? There is a point where newer and more efficient is better, but in general it’s better to hold on devices for longer.
- pdimitar 5y agoI don't, mostly because the manufacturers are far disconnected from the needs of the end users of computing -- they mostly serve big businesses. So the machines end up manufactured anyway. On this lane of thought, I'd say better to buy a laptop today (that's much greener than everything before it) that you can hold on to for 10+ years than holding on to another that has long passed its expiration date. But I am aware that this is not always a popular opinion.
- jfrunyon 5y agoBig businesses are the end users of computing. But that doesn't change anything. Why do big businesses have to upgrade their computers every few years?
- pdimitar 5y agoThat I don't know. I personally wouldn't. I've seen big companies where 100+ people who just do Zoom / Excel / Jira all day have MacBook Pros, which is insanity. I was simply mentioning that the machines get manufactured anyway so I definitely refuse to be guilt-tripped into "it's your fault that those machines exist!" extremist stance. No, it's not my fault. The machines are manufactured regardless of what I do so every 7-8 years I evaluate the market and upgrade. Reasons are simple -- most modern software gets slower all the time and I still need to work and support my family. I would hold onto my machines for a lifetime but it's not the reality we live in and I wish the downvoters stopped being so tunnel-visioned and were aware of that.
- frereubu 5y agoMy guess (and it is a guess) is that the extra heat / electricity consumption is pretty negligible compared to the amount of energy and raw materials needed to manufacture and distribute a new computer.
- pdimitar 5y agoTrue, but as I said in another sibling comment -- the machines get manufactured anyway (since the production capacity is mostly optimized around the needs of big customers) so I might as well get a much greener machine now and hold on to it for 10+ years because I will burn less CO2 while I am using it.
- deleted 5y ago[deleted]
- jhoechtl 5y agoYou save more (money and ressources) by not buying a new engine.
- pdimitar 5y agoYou assume that my goal is to spend the absolute minimum sum on tech over my entire life. That's not it. My goal is to spend the minimum realistic sum for tech that enables me to do my job well and long-term so I am financially free and help the businesses that hire me, and keep improving my craft (for which I have love ever since a pre-teen). That doesn't equal holding on to a MacBook Pro 2012 until 2030. It equals keeping an old machine around to check if the code in the final version of my current PR is well-optimized -- but I work on a much stronger machine because stuff like LSP and re-running tests is crucial for productivity. And we all know that most dev tooling is generally extremely demanding.
- frereubu 5y agoThat logic makes the "re-use" part of "reduce, re-use, recycle" redundant. You're part of a society that, when acting roughly in tandem, can make large-scale chages. If everyone followed your logic nothing would ever change and, if I'm honest, it sounds more like a rationalisation for indulging in new tech (an impulse which I share!)
- bad_alloc 5y agoWe can run those inefficient machines on electricity from renewable sources. Reduce > Reuse > Recycle applies: Building a new computer will almost always be worse than keeping the old one, whose production cost has already been paid.
- pdimitar 5y agoWe can, but do we really? I am fully behind your idea but sadly the whole "let's move to renewables" thing just takes so damn long. :(
- AussieWog93 5y agoI did exactly that (well, almost that - I downclocked my Phenom II to 1.7GHz and disabled all but one core) when I wrote my first commercial app back in 2016. It ran great with a few optimisations (or more specifically, removal of some really dumb code). It seemed really obvious to me to ensure it would run well on a broad array of old hardware, and I suspect this is because of all the time spent on OCAU as a teenager trying to get the cheapest hardware possible to play the latest games.
- miltondts 5y agoYeah, all this concern with scalability, portability and clean code, has created quite a dystopian software world. A world where software can barely fit in a single machine and can only scale up. In many cases, this software doesn't even do anything that is functionally different from 10 or 20 years ago, but it still consumes many more resources. A world where some websites still don't work properly across web browsers. Electron apps which should enable easier cross platform applications, don't (e.g. Microsoft Teams doesn't have feature or even UI parity in windows and linux). A world where clean code destroys performance, because the time of developers must be paid for by the company, but the costs of resource wastage are externalized. And there isn't even any evidence that these practices actually help to do what they are supposed to do!
- kortex 5y agoSo what do we do about it? Even if Electron doesn't give feature parity across OSes, it still has some other huge wins. It allows you to use "webdev" talent to build guis, which are (I presume) easier to hire. They can use their favorite frameworks. It seems like SPA-esque-apps have some agility in development over other native approaches. It makes updates, CI/CD, and testing easier. Even if not prioritizing cross-platform, Electron has some serious appeal. What are my alternatives? Qt? Gtk? Native libraries?
- Wowfunhappy 5y ago> What are my alternatives? Qt? Gtk? Native libraries? I don't know what the development side is like, but as a user I do find Qt apps to be fairly nice. I also think Java (Swing) apps are basically fine. Java was "bloated" back in the day, but not relative to what else is in use today.
- kortex 5y agoHm, Jvm also gives access to Kotlin and Scala, I'll definitely have to look into it. Qt development can be excellent or nightmarish, sometimes both. I don't know enough to know why the disparity but I've been adjacent to teams that love qt and ones that loathe it. I'm guessing a big aspect is state management; qt predates the reactive revolution, and IIRC is prone (as is any gui) to callback hell.
- q-big 5y ago> I only say this half-seriously, but that's why I sometimes think that part of any performance test should be "try to run your software on a Pentium 4". If it's unusable, go back and optimize some more. The condition that the software has to be able to run on a Pentium 4 makes quite some performance optimizations impossible.
- madpata 5y agoNo, the obvious solution is paying a monthly subscription to use a cloud-based computer for such high-intensity tasks like web-browsing. We should all be using https://www.mightyapp.com https://www.mightyapp.com! /s
- lotsofpulp 5y agoIs this an elaborate joke website?
- jmiserez 5y agoNope, see https://www.ycombinator.com/companies/mighty https://www.ycombinator.com/companies/mighty and https://news.ycombinator.com/item?id=26957215 https://news.ycombinator.com/item?id=26957215
- citizenkeen 5y agoOur team keeps our dev and test deployment ecosystems at about 40% of the resources of production. If it's too slow for us, then we optimize, and then it's smooth as silk in production.
- jcelerier 5y agoMy personal rule-of-thumb is that I develop with -O0 -fsanitize=address -fsanitize=undefined And things have to stay instant So far that has reliably meant that the software is useable on e.g. a raspberry pi 3.
- jsnell 5y agoNot entirely sure if you're serious, but that doesn't seem to make a lot of sense. You are not creating an environment where you're optimizing or scoping the project for slow machines. Instead you're optimizing for an environment with totally different performance characteristics, and manually doing low value optimisations that the compiler could normally handle. (E.g. O0 will mean no inlining, so you're incentived to do it at the source level, wasting effort, making the source less readable, but not actually getting any speedup on a production build )
- jcelerier 5y ago> so you're incentived to do it at the source level It's definitely not something I felt the need to do so far - my code is chock-full of high-level abstractions (and a lot of TMP). Where this helps is, noticing things like redoing a computation every time instead of caching the results, copying things left and right, etc. and more generally preventing "death by a thousand cuts" as just iterating a semi-large array more than necessary will make things noticeably slow if using asan (and, in my experience, slow computers - i've got a non-negligible portion of my user base using things like 2008 entry-level laptops for instance)
- pjmlp 5y agoWhat about -Wall and -Werror? :)
- jcelerier 5y agohere's my warnings list : https://github.com/ossia/score/blob/master/.cninja/score-warnings.cmake https://github.com/ossia/score/blob/master/.cninja/score-war...
- f00zz 5y ago> try to run your software on a Pentium 4 Alternatively, on Linux you can limit the maximum CPU frequency with something like FREQ=800000 # 800 MHz for i in /sys/devices/system/cpu/cpu[0-9]*; do echo $FREQ > "$i/cpufreq/scaling_max_freq" done
- jozvolskyef 5y agoNote that this may not work out of the box, see https://unix.stackexchange.com/questions/153693/cant-use-userspace-cpufreq-governor-and-set-cpu-frequency https://unix.stackexchange.com/questions/153693/cant-use-use...
- f00zz 5y agoDoes that answer still apply? I'm using the intel_pstate driver and limiting frequency via scaling_max_freq seems to work fine. It should work, if I'm reading this correctly: https://www.kernel.org/doc/html/v4.12/admin-guide/pm/intel_pstate.html https://www.kernel.org/doc/html/v4.12/admin-guide/pm/intel_p...
- geoduck14 5y agoYou say this, but there is also a push for servers to be: in containers, server less, and loosely coupled One trend at my company is to have microservices, where a single app is "single function" and uses a LOT of network traffic to talk to other "single function" applications.
- dharmab 5y agoI often say to myself (tongue in cheek) "Chrono Trigger for SNES fits into 8MB. Chrono Trigger is a better piece of software than anything I have ever written. Why does my software need anything more?"
- beprogrammed 5y agoA good rule to program by.
- dhimes 5y agoAt the very least, test it in virtualbox.
- einpoklum 5y ago> Pentium 4 Not such a good choice. It was kind of a "strung out" processor, with an overly deep pipeline, plus there was that RDRAM business... I'd say maybe an Intel Pentium III coppermine, or maybe go AMD and choose the original Athlon. > I only say this half-seriously Why just half-seriously? Make it totally serious. > If it's unusable, go back and optimize some more. That too, but even more than that: Go back and make more initialization lazy; make sure your UI isn't overly de-prioritized in favor of other work; and make sure you have logic and UI for when certain thing take time, allowing them to still carry out some activity while waiting.
- dr_zoidberg 5y agoI used to do that test with a mobile pentium from back in the day... I think it was a T5600? The model name sounded like a terminator, that's for sure. Problem is that then AVX became a common thing (at least in part of what I run) so that processor became unusable. I moved to an i3-3120m, which supports AVX, but then AVX2 became a thing. I could've gone for a 4000-series i3 at that point, but I just grew tired. And Pentium/Celerons are a bigger mess to find because some of them are Atoms now. For example, I have a N4000 sub-notebook that I got for my mom to check her email and view online videos, and the things feels pretty snappy for those things. But then you try to run some numerical code and you find it's 50-100x slower than their bigger siblings... Turns out it has no AVX of any kind, and event though it says it supports SSE4, it feels possibly slower than the older Pentium I mentioned at the start, even with faster, dual-channel memory, and those old Intel didn't even have SSE4, just SSE3. But possibly at that point the 35W thermal headroom of theT5600 plays a big part as the N4000 is passively cooled and has a 6W TDP. Moral of the story? Even if you try to, it's hard to pick a slow/old processor that will support all the operations that your software could use. Some of the give a huge speedup. You have to pick your battles. You'd probably have an easier time underclocking a lot out of your current processor (and disabling a few things?) and call it a day for performance testing.