News for hackers. Stuff that matters.
Re:How much your computer can do in a second by userbinator on Sunday March 26, 2017 @10:59AM (#13961095)
Alternatively, this could be titled "do you know how much your computer could do in a second but isn't because of bad design choices, overengineered bloated systems, and dogmatic adherence to the 'premature optimisation' myth?"

Computers are fast, but not if all that speed is wasted.

A recent related article: https://news.ycombinator.com/item?id=13940014

Re:How much your computer can do in a second by sametmax on Sunday March 26, 2017 @01:20PM (#13961826)
It's wasted only if it's not traded for something else. But it is.

A lot of system would simply not exist if we would have waited for people doing it properly because there is a limited pool of very skilled experts and the demand for IT far exceed our ability to supply. Plus writing good code takes a lot of time and resources, but our society changes now so fast that it very well maybe rewritten next year.

Hence, we are trading computer power to compensate our limited human resource.

E.G: wondering why you see electron apps everywhere now ? Because until now making a beautiful, powerful and modern app with a portable GUI was something only a few people would be able to do. Now any web dev can do it, and they are able to solve problems that weren't solved before because nobody would be available to do it. At the price of performance, memory usage and the use of the ugliest programming language we ever made popular.

It's the same deal as before. When C arrived, Wordperfect died because they stick to assembly. For them, C was wasting resources.

When Java arrived, expert systems were turned to it because it was more productive than to write it in C. We didn't need it to be fast, but the companies wanted their tools to be produced quickly.

Then when the Web arrived, people were laughing about the quality of PHP (initially a Perl hack !). So many bad code, so many security fails, just a terrible, terrible stack of programming debt. But it created the web we have today because it was easy to use, and suddenly a lot of people could just write their web forum. Hell, I learned my job with EasyPhp.exe way before becoming a Python expert.

Nothing here is wasted. It's just implicitly and involuntarily invested.

Re:How much your computer can do in a second by aschampion on Sunday March 26, 2017 @01:51PM (#13962025)
> Because until now making a beautiful, powerful and modern app with a portable GUI was something only a few people would be able to do.

Except it's none of these things: electron apps suffer the same presentation-before-content problems as most of the web, they inherit all of the state bugs of web apps, and they're painfully slow despite usually just being menus of nested lists and text boxes. It's passing a burden from developers to users, which considering the huge asymmetry between these two groups that's typical (at least 3 orders of magnitude, and often 6 or more) is an enormous inefficiency.

I'm all for selecting tools and platforms to better optimize developer productivity, but it's not clear to me the web platform has actually accomplished that for all but a few types of applications, and pushing it to the desktop is resulting in cumbersome, unresponsive, needlessly fragmented interfaces.

Put simply: Amazon Music Desktop has untold development investment and a complete visual redesign every 6 months, but WinAmp circa 2001 is somehow a thoroughly better way of searching and playing music.

Re:How much your computer can do in a second by sametmax on Sunday March 26, 2017 @02:11PM (#13962148)
Let's be clear, I dislike slow apps, I think current behemoth web pages size is a monstrosity and every time I start an electron app (minus the excellent vscode), I scream in my head.

Yet.

Most electron app I tried have a ratio result/effort far better than any other solutions for the dev.

Re:How much your computer can do in a second by zeta0134 on Sunday March 26, 2017 @02:27PM (#13962248)
This cannot be understated. It really can't. The programmer in me will always be drawn to small, lightweight code that gets the job done while using minimal resources. But that programmer is an algorithmic designer, which doesn't often need to deal with the realities of UI, graphics card drivers, or cross-platform compatability.

Electron is popular precisely because it enables developers of nearly any skill level to solve real world problems without investing the additional time to become a systems engineer. And the truth of the matter is that there are many more real world problems that need solving. Computers are cheap, humans are expensive.

When performance matters, by all means, hire the expensive programmers and code it from scratch. Do it "right." But doing it at all is often the only thing that needs doing, and for those problems, Electron is often, begrudgingly, the best choice.

Re:How much your computer can do in a second by flukus on Sunday March 26, 2017 @09:51PM (#13964550)
> which doesn't often need to deal with the realities of UI, graphics card drivers, or cross-platform compatability.

What makes you think desktop programmers have to deal with graphics drivers? How is electron any better than desktop toolsets worse at dealing with the realities of UI work?

Re:How much your computer can do in a second by zeta0134 on Wednesday March 29, 2017 @04:51PM (#13990454)
For the graphics question, it really depends on how you define a desktop programmer. Most video game developers need to work with graphics at some point, and a great deal of professional creative software uses GPU acceleration. Whether you deal with the drivers directly or not, you're going through them, and end up bitten by weird bugs and platform inconsistencies in testing. (Why are my drop shadows pink? Oh, this is a known issue with Intel HD 4000 on OSX... that sort of thing.) To be fair, Electron doesn't solve this problem, and neither does any toolkit really, it just shifts the responsibility to the framework, rather than the application developer.

As for electron being better than existing toolkits as far as UI development? I don't think that's a fair assessment in either direction. It's a right tool for the job thing.

Electron's real strength is that it's web-based, so it's familiar to existing web developers. In that respect, it's a bit easier to use if you already know web technologies. But, it's not terribly good at native integration (Electron apps tend to feel like web apps because they are), and resource consumption is abysmal because it's going through the browser layer, and we all know Chromium isn't light on RAM usage. Other toolkits are far better at handling native platform integration and can be much more lightweight.

Again here, "better" is a really tough thing to define, as every team and project is going to have different priorities.

Re:How much your computer can do in a second by sametmax on Sunday March 26, 2017 @02:33PM (#13962283)
Honestly I will be able to accept the resource consumption in the long run. But the use of JS everywhere is the real hard part for me.
Re:How much your computer can do in a second by dottedmag on Sunday March 26, 2017 @02:39PM (#13962321)
WebAssembly and languages compiled to JS make it immaterial.
Re:How much your computer can do in a second by sametmax on Sunday March 26, 2017 @05:07PM (#13963301)
It has the potential to do so, but I'm waiting to see it for real before calling it. Right now it's just not the case.
Re:How much your computer can do in a second by millstone on Sunday March 26, 2017 @04:29PM (#13963083)
I'm not sure how. WebAssembly is more limited than JavaScript (e.g. no access to DOM), and also more limited than native code (e.g. much more limited threading story).
Re:How much your computer can do in a second by cryptarch on Sunday March 26, 2017 @08:18PM (#13964207)
I wonder how long after the WebAssembly DOM API becomes stable tbe first Rust-based "server and client written in one language" frameworks start popping up.
Re:How much your computer can do in a second by uryga on Sunday March 26, 2017 @05:32PM (#13963425)
I thought they were working on adding DOM stuff too?
Re:How much your computer can do in a second by stymaar on Monday March 27, 2017 @02:26AM (#13965576)
They are. And they are also working on having full multi-threading (thanks to SharedArrayBuffer).
Re:How much your computer can do in a second by flukus on Sunday March 26, 2017 @07:56PM (#13964118)
> Most electron app I tried have a ratio result/effort far better than any other solutions for the dev.

This is more about the experience of the developer. Anyone familiar with GTK or Qt (possibly others) should be able to bang out a UI pretty quickly, in many cases it will be much simpler than HTML+js+CSS. With Visual Studio you could slap together a win32 app pretty quickly.

But for some reason we decided we had to coddle developers who only know javascript.

Re:How much your computer can do in a second by reitanqild on Sunday March 26, 2017 @11:14PM (#13964873)
Cross-platform was mentioned upstream.

Microsoft finally seems to be learning now but I think it will still be a few years before people start creating cross-platform desktop sw in visual studio, if ever.

Re:How much your computer can do in a second by flukus on Monday March 27, 2017 @12:25AM (#13965167)
I think their intention is to make VS cross platform but not to provide a cross platform UI stack themselves. Even if they made any of their UI stacks cross platform, it wouldn't be particular compelling compared to something like qt (or GTK if you don't care about cross platform).
Re:How much your computer can do in a second by panic on Sunday March 26, 2017 @05:45PM (#13963483)
Why do we care so much about the dev? There are way more people who use a typical program than there are people who develop it, and these people often use the program more frequently than the developers make changes to it.

For example, if a feature is used every day for a year by 10,000 people, speeding it up by 200ms is worth over a month of developer time (200ms for 10,000 people over a year is 203 hours of time wasted, which is about 25 8-hour days, or five 40-hour weeks).

Re:How much your computer can do in a second by buzzybee on Sunday March 26, 2017 @06:12PM (#13963610)
This equation starts with 0 users and grows pretty slowly at first. It only flips once you have a critical mass of users, and by then it's "too late" to preventatively fix the architecture to bias to performance.

There are also lots and lots of products that take a "npm+glue" approach - they ship an initial version that leverages everything possible, and then run aground trying to make it to version 2, because the architecture is so reliant on the dependencies that it can neither be maintained nor support any additional features. This is a little bit different from the "Electron problem" in that it identifies a showstopper limitation to using developer-side easings, rather than a long-term paper cut issue.

Re:How much your computer can do in a second by panic on Sunday March 26, 2017 @06:24PM (#13963680)
This equation starts with 0 users and grows pretty slowly at first. It only flips once you have a critical mass of users, and by then it's "too late" to preventatively fix the architecture to bias to performance.

Sure, but everyone's always planning for the future when they choose databases, backend architecture, etc. Why not plan for the future in user experience, too?

Re:How much your computer can do in a second by photojosh on Sunday March 26, 2017 @07:53PM (#13964101)
Keeping I'm mind the things I've developed are niche and not large; a dozen users at one time is about as far as I've got....

With databases, I use SQLite for quick prototyping and single user apps, and Postgres for the multi-user ones. If I needed to scale, I'd optimise my queries better and consult an expert.

With backend architecture, I'm most experienced with Python, Django & Twisted. I know these are used in web-scale apps, so if I needed to scale, I'd once again optimise best I could and consult an expert.

Now, UI is a different kind of scaling problem, because ideally it's going to look and interact the same for 10 users as it does for a million. You're scaling based on the features you add as opposed to the number of users. How do you scale that?

I'd say it's just as is happening now; you rewrite the UI as you scale, because if your revenue grows with users, you can afford to. On mobile devices: web page -> mobile app with mainly HTML views -> full native UI. On desktop: background server + webpage (think Plex) -> Electron/web-tech-based app -> full native app.

The problem ends up being when your revenue is independent from number of users and you don't have the resources to do the rewrites. Or as is likely the case with apps such as Atom; a big part of your proposition is the availability of plugins from third-parties.

Re:How much your computer can do in a second by stymaar on Monday March 27, 2017 @02:36AM (#13965608)
> For example, if a feature is used every day for a year by 10,000 people, speeding it up by 200ms is worth over a month of developer time (200ms for 10,000 people over a year is 203 hours of time wasted, which is about 25 8-hour days, or five 40-hour weeks).

Is your company ready to pay $10-20k to its software supplier to save 200ms per person ? Rationally it may be a good idea, but I sincerely doubt anybody would pay for that.

Re:How much your computer can do in a second by kedean on Tuesday March 28, 2017 @11:12PM (#13983047)
You can't reduce it to those simple variables, though. What if the speedup is enough to remove multiple AWS servers, saving potentially thousands of dollars per year moving forward? What if those milliseconds are the ones that keep more users on your site, like in Amazon's famous search bar story?
Re:How much your computer can do in a second by BHSPitMonkey on Sunday March 26, 2017 @06:06PM (#13963583)
Who is funding the developer? Why should they spend $5k (plus the opportunity cost of not using that dev's time on more fruitful pursuits) on 2 weeks of micro-optimization so that their 10,000 users will each experience a speedup so small they'll never even notice (and certainly never pay extra for)? How do you justify that expense?
Re:How much your computer can do in a second by mrob on Sunday March 26, 2017 @10:39PM (#13964731)
200ms delay is easily noticeable. Even 50ms is noticeable. And latency is cumulative, and your user's hardware already adds some, so you never know exactly how much latency budget you have before the whole system feels unpleasant.

I think 25ms is a reasonable goal, and even 10ms wouldn't be a waste of effort. All interactive software should be written like a fast-paced action game.

Re:How much your computer can do in a second by panic on Sunday March 26, 2017 @06:22PM (#13963674)
I'm making a more abstract argument that doesn't have anything to do with money. The time people spend using a piece of software shouldn't be worth less than the time developers spend writing it.
Re:How much your computer can do in a second by BHSPitMonkey on Sunday March 26, 2017 @08:13PM (#13964192)
Okay, but under those conditions your argument can only be applied to a more abstract reality that isn't the one we actually live our lives in.
Re:How much your computer can do in a second by nemothekid on Monday March 27, 2017 @02:45PM (#13970515)
The time developers spend writing a piece of software is worth what people are willing to pay for it. It has everything to do with money - if the person using the software isn't willing to spend more for 200ms less in startup latency, it probably won't happen.
Re:How much your computer can do in a second by flukus on Sunday March 26, 2017 @09:54PM (#13964563)
> How do you justify that expense?

It makes it harder for your competitors to offer a better product.

Re:How much your computer can do in a second by pilom on Sunday March 26, 2017 @07:04PM (#13963879)
Pretty obviously, not all time is equal in the eyes of the company that owns the software. That month of dev time costs on the order of $10k-20k all it where the users time is free from their perspective.
Re:How much your computer can do in a second by jsudhams on Sunday March 26, 2017 @10:56PM (#13964794)
Only if those 10000 people do something else in that 200ms and also if they multitask it does not matter. Except in some HFT or other specific use cases, i dont think even 100000 will matter 200ms fix.
Re:How much your computer can do in a second by megablast on Sunday March 26, 2017 @06:07PM (#13963587)
Just like GUI apps then, Mac OS and Windows has many bugs, are painfully slow compared to no GUI, and create longer to write.
Re:How much your computer can do in a second by danellis on Sunday March 26, 2017 @02:57PM (#13962434)
> until now making a beautiful, powerful and modern app with a portable GUI was something only a few people would be able to do. Now any web dev can do it

Anybody could do it before, including web developers, using, say, Qt with C++ or Python.

Or are you suggesting that web developers are not capable of learning?

Re:How much your computer can do in a second by sametmax on Sunday March 26, 2017 @05:08PM (#13963308)
No I'm suggesting the ratio result/effort between a QT app and a electron app is strongly in favor for electron for web dev.

Actually I'm not suggesting. I'm witnessing.

Re:How much your computer can do in a second by ori_b on Sunday March 26, 2017 @02:30PM (#13962270)
I mostly do back end code. But when I look at electron and compare it to something like QT Quick, QT Quick looks much more pleasant and easy to use to me.
Re:How much your computer can do in a second by sametmax on Sunday March 26, 2017 @02:34PM (#13962287)
Electron targets front end dev and people with knowledge of JS + HTML + CSS.
Re:How much your computer can do in a second by ori_b on Sunday March 26, 2017 @04:18PM (#13962996)
So, your claim is that using electron has got nothing to do with it being easier or simpler. It's just running off inertia?
Re:How much your computer can do in a second by sametmax on Sunday March 26, 2017 @05:11PM (#13963319)
HTLM + CSS is right now the easiest combo to create a really custom UI. Try to do something very custo with QT or Wx that is portable and you'll notice it's way, way more work. Combine that with the face web dev already know HTML + CSS and the related tooling, and you got the answer.

Electron apps are slow, eats a lot of resources, weight a lot of Mo and don't have a native UI integrated with the OS. You really need a SUPER good reason to use it. And the reason is it's familiar, easier and more productive.

Re:How much your computer can do in a second by ori_b on Sunday March 26, 2017 @05:14PM (#13963337)
Is it? Looks pretty easy to me: http://doc.qt.io/qt-5/qtquick-canvas-example.html

You get a full scene graph to play with. What exactly do you think is missing? http://doc.qt.io/qt-5/qtquick-visualcanvas-scenegraph.html

Re:How much your computer can do in a second by chii on Sunday March 26, 2017 @06:05PM (#13963578)
the fact that you have to use a scene graph?
Re:How much your computer can do in a second by ori_b on Sunday March 26, 2017 @06:49PM (#13963816)
What would you use in HTML for a completely custom component? As far as I understand, you'd have to build your own scene graph on top of a canvas.

I mean, if you want standard or semi-standard components, QT has far more out of the box components than HTML does, but the initial complaint was about flexibility for doing something 'very custom'.

Re:How much your computer can do in a second by VeronicaHadley on Monday March 27, 2017 @02:40AM (#13965614)
QT Quick is really adorable way to put in programming logic with improved UI.
Re:How much your computer can do in a second by dotancohen on Monday March 27, 2017 @02:15AM (#13965542)
> E.G: wondering why you see electron apps everywhere now ? Because until now making a beautiful, powerful and modern app with a portable GUI was something only a few people would be able to do.

You should really take a look at Python and Qt. Beautiful, easily maintained and well-performing cross-platform apps have been a possibility with this pair for the better part of a decade. Anki is my favorite example, but there are plenty of others.

Re:How much your computer can do in a second by sametmax on Monday March 27, 2017 @02:23AM (#13965566)
I'm a python expert, I know. You are missing the point: electron apps target front end devs. They are more of them, a lot more, than any other type of dev and they don't want to learn a new tech. Hell they even ported js to the server, an awful language, to avoir using something else.

Plus saying qt is easy to use to them is like saying java is productive to a python dev. You are not on the same scale.

Re:How much your computer can do in a second by pjmlp on Monday March 27, 2017 @03:00AM (#13965687)
Front end web devs.

There are still some of us that do actual native frontends.

Re:How much your computer can do in a second by milesrout on Sunday March 26, 2017 @09:53PM (#13964559)
>A lot of system would simply not exist if we would have waited for people doing it properly

And we'd be better off. We'd be better off without Atom and VS Code.

Re:How much your computer can do in a second by nashashmi on Sunday March 26, 2017 @02:10PM (#13962138)
So by making a complex task much much easier, we have traded efficiency for larger numbers of wasteful systems.

The Crux of industrialization?

The future of mankind? Make task easy. Get more people to do task.

Re:How much your computer can do in a second by JustSomeNobody on Sunday March 26, 2017 @07:17PM (#13963923)
> E.G: wondering why you see electron apps everywhere now ? Because until now making a beautiful, powerful and modern app with a portable GUI was something only a few people would be able to do.

Take portable out and it gets so much easier.

Re:How much your computer can do in a second by jerrysievert on Sunday March 26, 2017 @11:37PM (#13964981)
take out beautiful and it gets so much easier too.

I guess that gives us:

* portable

* beautiful

* fast

(choose 2)

Re:How much your computer can do in a second by K0SM0S on Monday March 27, 2017 @08:28AM (#13967097)
That was so acid. ;-)

But besides my pun, "fast" code is a moving target relatively to the end result (see how performance considerations about Java running in a VM became moot because of hardware improvements notably on the CPU; see how today multithreading is making a comeback to rescue CPU-bound applications from stale improvements).

Fast is also subjective, it's cultural in that it's a trained perception. I'm annoyed if Excel takes more than a couple seconds to launch, but most people are used to 10s at least, because that's our daily experience. Likewise, I remember a time when having pixelated thumbnails until images loaded completely over dozens of seconds was the best browsing experience; nowadays on fiber/LTE we expect a page to appear rather instantly.

I guess what subconsciously annoys the hell out of "those who like as fast as possible applications" with Electron is that we know it will yet make fast a more distant concern overall, at least until hardware makes the Electron performance penalty moot, like Java VM.

I'm pretty convinced 'fast' is indeed a clear third priority for most consumers though, seeing how it doesn't seem to bother most people in UX research (less so than many other concerns), or how Apple rides ever more financial success while releasing ever slower hardware and software (comparatively to the whole market, and sometimes astonishingly even to their own previous models). Facebook is bloated as hell too these days, but it's as popular as ever. Spotify is sluggish too, even Twitter. People just don't seem to care, the looks and simplicity of use seem more determinant.

Re:How much your computer can do in a second by mr_overalls on Monday March 27, 2017 @10:55AM (#13968208)
"Everything is for the best in the best of all possible worlds." --Candide, Voltaire
Re:How much your computer can do in a second by agumonkey on Sunday March 26, 2017 @11:10AM (#13961153)
The market is wasteful. Lots of things are subpar because of the competition requiring adhoc solutions pushed to market, then becoming standard, so on and so forth. You can blame the game or not. At least if there was some acknowledgement of that process and a little cleanup time to spread good ideas and good fix ...

Personally I always feel weird booting up old boxes (say old = Pentium 2) and realizing how much the whole platform could do. It also felt quite sufficient in terms of UX and presentation.

That's odd because, everybody (I assume) feels how quickly we feel our newest gear gets slow, and how a new generation improves speed. But when I pop a very old system I don't feel slowed down much. It's just of a lesser resolution (hi res images, sound, videos); which for my needs doesn't really matter.

Re:How much your computer can do in a second by gizmo on Sunday March 26, 2017 @11:32AM (#13961259)
An eye-opening experience is running an IDE like Visual Studio 6 or a really old version of Photoshop on a modern machine. It starts instantly, compile times are a fraction of what we're used to. The interface is totally responsive. It's remarkable how much better software feels when everything is instant.
Re:How much your computer can do in a second by em3rgent0rdr on Sunday March 26, 2017 @01:24PM (#13961851)
It's remarkable how much better software feels when the software was developed on a slow machine.

Unfortunately devs invest in the fastest equiplent, so they don't experience how their code runs on the average end user who doesn't upgrade every couple years.

In can be useful to test your code in a VM that is deliberately slowed down, so can get a feel for user experience on a slower machine. Then you'll know what parts need to be optimized.

Re:How much your computer can do in a second by Gracana on Sunday March 26, 2017 @06:42PM (#13963790)
> Unfortunately devs invest in the fastest equiplent, so they don't experience how their code runs on the average end user who doesn't upgrade every couple years.

As someone who doesn't spend much on computer upgrades, I notice this everywhere. Especially when it comes to web development, where everything is optimized for chrome on mac. Don't have a laptop made in the last year? Enjoy a janky-scrolling slow-loading hard-to-read mess.

Re:How much your computer can do in a second by snackai on Sunday March 26, 2017 @08:46PM (#13964303)
Also, the web devs have no idea how slow the connections in even the western world can be. At least I think so, if they had to experience a 4 Mbit/s connection more often they wouldn't push for Angular and such.
Re:How much your computer can do in a second by adrianN on Monday March 27, 2017 @04:05AM (#13965919)
4Mbit/s is slow nowadays?
Re:How much your computer can do in a second by megablast on Sunday March 26, 2017 @06:24PM (#13963686)
Unfortunately devs aren't given any time to optimise it to run on slow machines. It is not a priority.
Re:How much your computer can do in a second by ryukafalz on Sunday March 26, 2017 @07:35PM (#13964021)
You don't necessarily need to specifically optimize for it: just do your development on a slower machine. If you're using a compiled language, you can offload compilation with something like distcc for productivity's sake, but all your testing should be on the slow machine.

It'll be pretty clear if some change you've made is going to impact people on older hardware, because you'll notice the moment you make the change. And if it's unbearably slow for you, it will be for a good chunk of your users as well.

Re:How much your computer can do in a second by userbinator on Sunday March 26, 2017 @11:51AM (#13961349)
Developer tools like Visual Studio are somewhat ironic in that the developers who create inefficient software are essentially seeing this reflected indirectly in their tools also becoming inefficient. A perverse version of "do unto others as you would have them do unto you"?
Re:How much your computer can do in a second by agumonkey on Sunday March 26, 2017 @11:56AM (#13961377)
I used to think that of the java world. It wasn't above some critical mass / threshold of simplicity, and everybody that liked java lacked that simplicity, and every solutions they tried to add to java just added more cruft (xml, j2ee beans, IDEs)
Re:How much your computer can do in a second by bcook on Sunday March 26, 2017 @12:33PM (#13961572)
Similarly, I run a very barebones Openbox Arch Linux install on my ancient 2Ghz Turion 64 laptop and I recently booted Windows XP on it and I was blown away by how fluid & responsive the entire system was compared to my much newer Linux-based OS.
Re:How much your computer can do in a second by agumonkey on Sunday March 26, 2017 @12:35PM (#13961584)
Also, surprisingly, XP could handle 64MB decently (even for a nazi like me)
Re:How much your computer can do in a second by flukus on Sunday March 26, 2017 @08:05PM (#13964162)
My memory is very blurred, but I thought 32MB (maybe less) was still pretty standard when XP came out.
Re:How much your computer can do in a second by logicallee on Sunday March 26, 2017 @11:57AM (#13961381)
>An eye-opening experience is running an IDE like Visual Studio 6 or a really old version of Photoshop on a modern machine. It starts instantly, compile times are a fraction of what we're used to. The interface is totally responsive.

If you gave that to a Product Manager candidate (as part of an interview) and pretended it's your current product (assume they didn't know it already), asked them to play around with it for ten minutes and as their task come up with some thoughts regarding what they would add or improve, their eyes would pop open and they would say, "WOWWW!! THIS LOOKS LIKE IT ISN'T DOING ANYTHING -- THERE IS A LOT OF ROOM FOR IMPROVEMENT HERE."

And in just fifteen minutes, they would gleefully tell you exactly how they would break it. (By adding crap to make it slow.)

(Note: this could be run as a real experiment, but the results above are my personal prediction - maybe it wouldn't happen as I predict.)

I really do think product managers are the people to blame here. To them, fast = broken or not doing anything. It's not done (to them) until it's (to us) broken.

Re:How much your computer can do in a second by flukus on Sunday March 26, 2017 @08:09PM (#13964180)
A lot of places I've worked had government incentives to do this too. Adding features is "R&D" and attracts less payroll tax than optimizing bugs does. Other companies structure themselves this way, a feature is something you can charge to another department, an optimization isn't.
Re:How much your computer can do in a second by dbattaglia on Sunday March 26, 2017 @09:36PM (#13964489)
I've worked at one place in particular that fell in love with what I call FDD, Finance Driven Development. There's few things more demoralizing than watching systems you helped design fall apart because bug fixes aren't capitalizable.
Re:How much your computer can do in a second by tedunangst on Sunday March 26, 2017 @12:03PM (#13961408)
Or start with the current version, then demo the ancient version, and claim you've "streamlined and tuned" the program?
Re:How much your computer can do in a second by logicallee on Sunday March 26, 2017 @12:19PM (#13961486)
What I was getting at is that the suggestions to add crap would come from the product manager candidate themselves - thereby "proving" (if the results match my prediction) that the requirement for slow unresponsive interfaces come directly from the PM's, who would add it if it weren't already slow.

Like, I want the experiment to test if a product isn't already slow, would a product manager actively make it slow? (I think, "yes".)

Re:How much your computer can do in a second by gizmo on Sunday March 26, 2017 @12:33PM (#13961573)
When software is too slow it hurts sales. When software lacks features that hurts sales too. Faster doesn't make for compelling marketing (anybody can claim their software is fast) but you can get people to upgrade for new features. So features are added with every release and performance improvements are made up so to the point where it's "good enough" again. You don't need a product manager conspiracy to explain why software is bloated and slow.
Re:How much your computer can do in a second by logicallee on Sunday March 26, 2017 @12:48PM (#13961649)
Okay, so let's update the experiment protocol.

So the hypothesis is that if it's too fast it's not considered done by a product manager. So as an updated test protocol, let us repeat with two groups of Product Managers, and this time they must evaluate the software, which they have never used before. Some candidates get the older version on the metal, and others get the older version slowed down 10x for example by running in a VM on the test machine, or simply being shown to them running on older hardware but otherwise an identical setup.

My hypothesis is that the exact same software running slowly would be objectively judged as better by Product Managers than the same software running instantly. That instant execution is considered an explicit negative point - completely independent of features. So that if the old software running slowly gets 7.5/10 rating by the Product Managers asked to evauate it, it would get only a 5/10 rating if it runs instantly.

This controls for the features which you mention. So I've suggested a test protocol, of course I can't verify it just at this moment but at least I am being scientific in my suggestion that Product Managers simply rate fast software worse. If you have an alternative protocol to test this, one that is easier to run, I'd like to hear it.

Re:How much your computer can do in a second by gizmo on Sunday March 26, 2017 @02:25PM (#13962232)
If slowness is the goal and if product managers insist on slowness, then you'd expect a lot of sleep() calls in commercial software (which has product managers) and no sleep() calls in open source software. This doesn't happen.

What we see is that commercial software has better documentation, gets more long term maintenance and support, and supports more cumbersome enterprise features. Exactly what you'd expect when you have salespeople and product managers who talk to customers.

Your hypothesis is falsifiable, which is a necessary but not a sufficient condition for it to be scientific. For it to be scientific you would also have to provide evidence that your hypothesis is more plausible than the alternatives, before you do any experiments. After all, it's easy to come up with thousands of silly hypothesis, and by happenstance some of them will get a positive correlation when tested. So every hypothesis has to undergo serious scrutiny.

Re:How much your computer can do in a second by tedunangst on Sunday March 26, 2017 @02:57PM (#13962433)
Actually, some software like facial recognition or OCR, does have sleep calls inserted because people don't believe it can be done as fast as it can be done. Thus, whenever I deposit checks at the ATM, I have to stand there and watch as some entirely unnecessary animation pretends to scan my check for ten seconds before I can have my card back.
Re:How much your computer can do in a second by gizmo on Sunday March 26, 2017 @03:16PM (#13962550)
Yes, the same applies to save buttons. If saving takes less than 200ms people are not confident the save really happened. There are also UI animations that deliberately slow things down to prevent the user from getting disoriented. This doesn't prove that product managers want software to be slow though.
Re:How much your computer can do in a second by tedunangst on Sunday March 26, 2017 @03:25PM (#13962598)
Agreed. I think PMs have their own motivations, but ruining things for others is not explicitly part of their grand plan.
Re:How much your computer can do in a second by logicallee on Sunday March 26, 2017 @05:48PM (#13963499)
I don't think it's fair of you to switch to the language "ruining things for others" - of course they don't want to explicitly "ruin things".

If you had said, "I don't think making sure that things don't happen instantly is explicitly part of their grand plan" then I would dispute that statement. (Yes, making sure things don't happen instantly is explicitly/implicitly part of their grand plan.)

They want users to have an "experience" not just click a button or press a key and instantly see the result. It is very explicitly part of their plan, and if the algorithms don't slow things down enough, they actually request animations or loading screens that do so.

Some of it may be implicit, rather than explicit. For example, a front-end javascript framework might actually produce pixel for pixel the exact same result as a simple HTML file generated more quickly on the back-end might do, but could still be a preferable "experience".

All this could be tested explicitly. For example two groups of PM's could evaluate web sites, where one included Working... screens where a javascript framework slowly renders something client-side, and the other could have pixel-for-pixel the same thing served from the server, using less bandwidth than it took to even transfer the javascript files over, so that the result is served much, much faster.

I hereby formally predict that some PM's will prefer the slower version for the exact and only reason that it is a slower user experience, and that this could be verified with a double-blind and carefully controlled experiment. I've put my claim out there, and it is easily falsifiable as well as has explanatory power in terms of the software we actually see.

Very simply: some PM's prefer a slower user experience. (I claim.)

Re:How much your computer can do in a second by Johnny555 on Monday March 27, 2017 @12:38AM (#13965212)
I think that's the time to scan both sides of the check (which is not done with a photo scanner, but with a sheet fed scanner, so it's not instantaneous), upload the image (potentially over a very slow network link), add it to the OCR queue on the server, do the OCR, save the image, and return the results back to the ATM machine.

I highly doubt the ATM maker put in sleep calls to intentionally slow it down -- no one is going to be surprised if it takes 1 second instead of 10 seconds to scan a check.

The bank could optimize for time, but it's not their time, it's their customer's time and they are already saving so much money over a teller transaction, they likely don't care about saving customers a few seconds.

Re:How much your computer can do in a second by FridgeSeal on Sunday March 26, 2017 @06:17PM (#13963645)
This strikes me as some kind of terrible vicious cycle: tradeoffs against performance (towards build speed) were made > users got used to slower software > users unconsciously prefer/select for slower software.

When you do get to use it, using performant software is a really great experience, so how to we train users to appreciate this?

Re:How much your computer can do in a second by nostrademons on Sunday March 26, 2017 @07:23PM (#13963962)
Sometimes companies do decide to make speed a priority, and earn literally hundreds of billions of dollars off it. One of Google's key features over Yahoo+Altavista was that it loaded instantly; they cut out all the crap from the homepage so you could get yourself to a result in under a second.

Ditto BitTorrent clients like uTorrent and Transmission; the first generation of BitTorrent clients were written in Python or Java, and felt like it. When users started complaining about how they would lock up your machine, somebody actually bothered to write one in highly-optimized native Win32 C, with no frameworks.

You have to understand what the customer is optimizing for though. Someone standing at an ATM is optimizing for confidence, not speed; they already took the time to drive to the ATM, so depositing their check in 1 second vs. 10 seconds doesn't matter when the whole trip takes them 10 minutes. Someone who's responsible for depositing 1000s of checks for a major business, using an office scanner, cares a lot. But I really doubt that industrial-strength check cashing apps put a sleep() statement when scanning the checks.

Re:How much your computer can do in a second by logicallee on Sunday March 26, 2017 @02:56PM (#13962422)
>If slowness is the goal and if product managers insist on slowness, then you'd expect a lot of sleep() calls in commercial software (which has product managers) and no sleep() calls in open source software. This doesn't happen.

Why do you say this doesn't happen, when it does, in fact, happen? An example of which would be this:

http://osxdaily.com/2015/01/06/make-the-window-resizing-anim...

This is a very explicit "sleep". It is far from the only one. Are you saying someone didn't think the slower animation was "better" than the faster animation - that the default time wasn't picked by a product manager?

>What we see is that commercial software has better documentation, gets more long term maintenance and support, and supports more cumbersome enterprise features. Exactly what you'd expect when you have salespeople and product managers who talk to customers.

We also see fancy loading graphics and I consider it extremely plausible that product managers consider fast/instant operation as room to add something to slow it down. I am not sure why you're debating this.

Regarding your open-source claim, this comment - https://news.ycombinator.com/item?id=13940014#13940458 - shows that fancy progress bar animations are considered more important, even in a commandline utility, and even under Linux. In other words, the fact that these progress bar animations slowed core functionality by 50% was -- in point of fact -- not an issue. Someone spent the time to create them, test them, commit them, and these were accepted: someone considered it objectively (or subjectively) better.

>Your hypothesis is falsifiable, which is a necessary but not a sufficient condition for it to be scientific. For it to be scientific you would also have to provide evidence that your hypothesis is more plausible than the alternatives, before you do any experiments.

You don't think surveying the actual decisions made in cases (such as the two examples just quoted, the window animation speed and the progress bar speed) where there was no functional difference except slowness, to be a plausible reason for supposing that people in charge of these choices choose a slower version? I think it's quite plausible that for whatever reason, slow software is preferred explicitly and implicitly.

>After all, it's easy to come up with thousands of silly hypothesis, and by happenstance some of them will get a positive correlation when tested. So every hypothesis has to undergo serious scrutiny.

I didn't spend much time looking through it in the original leak (on Wikileaks) but Bruce Schneier quoted on his blog Do's and Don'ts by an intelligence agency:

https://www.schneier.com/blog/archives/2017/03/the_cias_deve...

The parts I'd like to draw attention to:

- DO NOT perform operations that will cause the target computer to be unresponsive to the user (e.g. CPU spikes, screen flashes, screen "freezing", etc).

- DO make all reasonable efforts to minimize binary file size for all binaries that will be uploaded to a remote target (without the use of packers or compression). Ideal binary file sizes should be under 150KB for a fully featured tool. Rationale: Shortens overall "time on air" not only to get the tool on target, but to time to execute functionality and clean-up.

- DO NOT perform Disk I/O operations that will cause the system to become unresponsive to the user or alerting to a System Administrator.

Now I would just like to note that the other requirements are actually SUPER advanced - the binaries are expected to include complete encryption and decryption, as well as generating completely standard and compliant HTTP traffic that it is wrapped in, under another layer of functionality. There's a ton these binaries do.

You will very rarely see requirements similar to what I just quoted in most open source or commercial software. While I realize that when binaries involve active involvement with the user, they will necessarily be a bit more bloated/slower/etc.

But most software does not seem to care about being unresponsive, having huge binary sizes, causing CPU spikes, and generally being slow. I don't want you to misunderstand. I am quoting the above requirements for a piece of spyware to show you requirements that are emphatically NOT in any Product Manager's vocabulary. No Product Manager ever seems to tell their programmers to make a tiny, streamlined product that does not cause any unexpected delays or runs like molasses instead of instantly.

So I would say that on the whole my hypothesis that slower software is considered objectively better by Product Managers has high plausibility. The fact is, you are already suggesting that if the slower software is evaluated as better than the instant software, it will be "by happenstance."

Maybe so - but the fact that product managers choose slowness over speed every day, everywhere, speaks otherwise. Unfortunately I am not in a position to show this scientifically, and also social science experiments are particularly difficult to produce or replicate, with close to half being unreproduceable:

http://www.nature.com/news/over-half-of-psychology-studies-f...

"Over half of psychology studies fail reproducibility test".

So if you are a product manager, I would just like you to compare the requirements you've ever given out, to the ones I've just quoted (which I consider great requirements.) Of course, I use some minimal programs that meet the description. But as a rule these are programs produced by a single programmer, with no PM in sight.

It was nice to talk to you but you seem to view the software landscape differently from how I do. I think it's easy to see that our perspectives are very different.

Re:How much your computer can do in a second by mwcampbell on Sunday March 26, 2017 @12:29PM (#13961544)
On further consideration, though it's common to talk about an upgrade treadmill or "what Andy giveth, Bill taketh away", software actually does get better over time, and we shouldn't look back so fondly on older versions. To pick just one example, software in the 90s didn't have inline spell checking as you type, a feature that came in handy for me just a few minutes ago while editing my other comment. Still, the question remains: why doesn't everything feel instant on our current systems, and what do we do about it?
Re:How much your computer can do in a second by MagnumOpus on Sunday March 26, 2017 @03:47PM (#13962782)
> To pick just one example, software in the 90s didn't have inline spell checking

To pick on your example - it is interesting that you have to go back 20 years to find a feature beneficial for the everyman, and that you are still wrong: Just about every word processor starting from MS Word 95 came with inline spell checkers. (And indeed I prefer the snappiness and identical feature set of my copy of Office 2003 to the ribbon-laden gigabyte-guzzling mostrosities of Office 201x, just as I prefer a 15-year-old Winamp to the latest Itunes player.)

Re:How much your computer can do in a second by klibertp on Sunday March 26, 2017 @04:00PM (#13962873)
> To pick just one example, software in the 90s didn't have inline spell checking as you type

What? Which 90s exactly did you live through? Because I seem to remember MS Word 6.0 having not just spell checking as you type, but also the dreaded autocorrection feature. That was in 1993 according to Wikipedia.

Re:How much your computer can do in a second by mwcampbell on Sunday March 26, 2017 @11:52AM (#13961353)
So is there any way to stop this treadmill, short of overthrowing capitalism itself?

Edit: If that seems like a non-sequitur, I said it because the parent comment started by saying that the market is wasteful.

Re:How much your computer can do in a second by userbinator on Sunday March 26, 2017 @12:09PM (#13961427)
I don't think capitalism is to blame, as this is endemic even in free software. The way to stop this is to stop repeating dogmatic myths about optimisation, consider efficiency/optimisation as an integrated part of the design process and not something to be applied afterwards, and focus on "user time is expensive" instead of "developer time is expensive" --- and sometimes, those users may also be developers.
Re:How much your computer can do in a second by chii on Sunday March 26, 2017 @06:14PM (#13963627)
> user time is expensive

that's not always true, especially from the point of view of the dev.

Re:How much your computer can do in a second by username223 on Sunday March 26, 2017 @07:29PM (#13963992)
Yep. With forced auto-updates, software companies have implemented "software gavage," and the devs are just getting paid to push code down users' throats. It's much harder to entice users with something they might actually want.
Re:How much your computer can do in a second by gizmo on Sunday March 26, 2017 @12:02PM (#13961402)
There is certainly a case to be made for overthrowing capitalism, but I don't see why an anti-capitalist revolution would automatically result in a society with higher quality software.

Open source software suffers from much the same problems as commercial software. There is much about writing good software we haven't figured out how to do yet as an industry, and in the meantime we have to work with tools that are totally inadequate.

Re:How much your computer can do in a second by mwcampbell on Sunday March 26, 2017 @12:48PM (#13961650)
Why do you think our tools are inadequate? What would adequate tools be able to do that our current ones can't?
Re:How much your computer can do in a second by gizmo on Sunday March 26, 2017 @02:52PM (#13962395)
Way too much to cover in depth. In short, it's all terrible. We're mostly using tools from the 70s, and we're still to this day plagued by use-after-free and out-of-bounds errors, nullpointer exceptions, awful debuggers, race conditions, slow compilation times, bad primitives for multithreaded work, just to name a few. We've known for decades that we can do better and ways to do better have been studied in depth by academia.

That's just the basics. Then there is futuristic things: Why can't we move running processes from one physical machine to another? Where are the debuggers that allow you to go back and forward in time? Why can't we visualize the data structures in our program and trivially change the data layout to see how that affects performance?

When I look at the demo of the Xerox Sparc interface (1982) and compare that to where we are today it's pretty clear to me we messed up big time somewhere along the road: https://www.youtube.com/watch?v=Cn4vC80Pv6Q

Re:How much your computer can do in a second by nostrademons on Sunday March 26, 2017 @07:47PM (#13964083)
For people who have an exceptionally high tolerance for learning what people actually care about and why the shitty technological solutions won in the marketplace, this is probably an opportunity.

When I entered the workforce in 2005 after learning all about bygone languages (Common Lisp, Smalltalk, Dylan, Haskell, Erlang, Ocaml, etc.) in college, it was really, really painful going back to Java. Java had gotten so many fundamental language features wrong when better alternatives were well-known in research literature. Monitors instead of CSP, null types instead of Maybe, inner classes instead of closures, manifest typing instead of type inference, no first-class functions, mutability everywhere, conflation of modules & classes, not even a semblance of pattern-matching. But I could use it to write software that performed well, that could be deployed with tooling that everybody used, that had a wide base of available libraries, that had IDEs and other tooling available, and that other programmers could maintain.

It's 12 years later, and all of my recent projects have been in some combination of Swift, Rust, Kotlin, or ES6+React. And most of these languages have: promises & message-passing instead of explicit locks; Optional types or at least some form of null-safety; lexical closures; type inference; first-class functions; immutable-by-default; module systems that don't require that you shove everything into a class; and pattern-matching. But they also did the hard work of figuring out an interoperability story with some large existing body of code; of writing decent package managers and easy build systems; of making the language reasonably performant for most everyday tasks; and of (in Swift & Kotlin's case) providing full support within an IDE. All the language features that were common in research languages of 2005 but missing in industrial programming of the time are now very usable in the industrial programming of now.

I wouldn't be surprised to see a similar renaissance in tooling over the next decade, with exotic features like time-traveling debuggers, fully-inspectable systems, and migratable processes becoming standard in the next generation of IDEs.

Re:How much your computer can do in a second by TeMPOraL on Sunday March 26, 2017 @03:27PM (#13962617)
> We're mostly using tools from the 70s

We're using the shittier tools from the 70s, because the better tools died off - which is sad, because we still didn't manage to recreate some of the features those tools offered. The success of UNIX and C seems to be caused by the same phenomenon that causes Electron to succeed and bloat to proliferate - what wins aren't good solutions, but those which get popular quickly.

Re:How much your computer can do in a second by chii on Sunday March 26, 2017 @06:17PM (#13963642)
> aren't good solutions, but those which get popular quickly.

but by the judgement of a majority, those tools are good! That's why it got popular. Any personal sense of aesthetics from you (or anyone) doesn't matter at all here, and most people who call tools that failed 'good' are only judging it by personal aesthetics.

Re:How much your computer can do in a second by TeMPOraL on Monday March 27, 2017 @12:33AM (#13965190)
I'm not talking aesthetics here; I'm talking about shitty engineering. Often legitimized by nonsense phrases like "worse is better" these days.
Re:How much your computer can do in a second by ue_ on Sunday March 26, 2017 @12:09PM (#13961428)
Within capitalism, products are made to maximise exchange value rather than use value. This is because it is more profitable to optimise for products to be exchanged rather than used. In fact, it can be detrimental to maximise use value, because a product that can be used for longer will mean that fewer people will have motivation to purchase another one any time soon.

I like the idea of overthrowing capitalism itself to resolve this.

Re:How much your computer can do in a second by icantdrive55 on Sunday March 26, 2017 @12:04PM (#13961411)
This will sound pathetic, and it's partially because I don't have much of a life, and spend way too much time with electronics, but one of my biggest regrets is---

Upgrading.

I've always fell for the increased security, and blah, blah, blah, but in the end I have a device, I once used, become slow, programs become useless, or my plethora of USB devises don't have the right updated firmware.

I have a Mac, and a MacBook Pro I'm thinking about wiping clean, and installing the original operating systems. It's just a pain, and yes--I know security is important.

I did finally learn on the IPad, but I'm still not completely sure I'm doing the right thing. I must have hit "tomorrow for 9.3.5---three hundred times. I just don't want to make this devise slower. I paid way too much years ago, and I hate putting things in my electronic graveyard--my closet.

Re:How much your computer can do in a second by angry_octet on Sunday March 26, 2017 @07:54PM (#13964109)
I can't upvote your most recent comment because you're attracted too many haters too quickly and the comment is in purgatory unjustly. In fact, I think you've attracted some regular haters, though I can't prove it. I suspect someone doesn't like your anecdotal style, but it is just as valid as an unsupported generalisation.
Re:How much your computer can do in a second by dahart on Sunday March 26, 2017 @12:08PM (#13961424)
To be fair, that article is discussing a small bug, not over engineering or dogma. The size of the deal people made over it was more wasteful than the CPU time this (now fixed) bug cost.

And FWIW, of all the problems that matter to me and my teams, I find premature optimization to be far, far more wasteful of money and human energy than wasted CPU cycles. There are definitely times to worry about performance, and I fancy myself a deeply performance oriented person, and yet I am and will continue to be proud of my dogmatic adherence to avoiding premature optimization, because in my experience it's not a myth at all. I have watched literally years and millions of dollars wasted multiple times by teams that decided to prematurely engineer high performance solutions to problem they thought they had but didn't actually. So I'm way more scared of premature optimization than I am of wasting cycles.

Re:How much your computer can do in a second by emcq on Sunday March 26, 2017 @12:59PM (#13961703)
By definition an optimization being premature means it's not necessary in the present. For these situations its like taking a loan for technical debt. In the future you may need 10x the resources to fix but in many environments that's acceptable due to company growth, or like you mentioned, spending money on compute rather then Dev time.

That said, I've been amazed what the top engineers in the field can design and implement getting things right the first time without additional effort. Simple, minimalist, high performance implementations that don't sacrifice much. There is a thin line between the beauty of those architectures and grab bag of pattern matching complex and unecessary optimizations.

Re:How much your computer can do in a second by jlg23 on Monday March 27, 2017 @03:11PM (#13970736)
> By definition an optimization being premature means it's not necessary in the present.

No, it is premature when it is not necessary for the deployment (at some future point in time).

When I was developing for mobile phones (long before the iPhone), the decision of what to optimize when required some educated guesses where the phone market would be in 6 months, when the application is market-ready. (And: In the end, we did optimize a lot of code that did need no optimization 6 months later, but those optimizations made development work much, much more bearable.)

Re:How much your computer can do in a second by dahart on Sunday March 26, 2017 @03:23PM (#13962595)
> an optimization being premature means it's not necessary in the present.

Yeah, spot on. What's really important is answering the question of what's necessary, that's really the key. Sometimes you do know that optimization will be necessary in the future even when it's not needed right now. If that's the case, the earlier you attack it, the better. But all of us (me included) tend to spend time on things we believe are necessary that turn out not to be.

> For these situations its like taking a loan for technical debt. In the future you may need 10x the resources to fix but in many environments that's acceptable

Definitely. There is the gamble that if you don't know for sure and you wait it might cost a lot more later. But I would go a lot further than that. The problem is that if you take the other route and optimize early on the wrong thing, it makes optimizing the right thing 100x more expensive in the future, not just 10x. It can be more expensive to optimize the wrong thing than it is to optimize the right thing late. This is because optimizations often require a different way to slice the code, to feed the limiting system with a different batch size, or to invert your high-level looping structure and swap the inner loop and outer loop.

If you've ever done image processing in Python, I always think of numpy vs PIL as a good example of slicing your batches a different way -- if you do it the easy way in PIL, you can write cool stuff in an hour, but your code might take 60 seconds to run on an image. PIL loops over pixels, and you put complex ops inside the loop. Numpy is opposite, you put the operations on the outside, and the loops on the inside (to allow the loops to be run as native compiled code). Numpy's harder to learn, the code is inside-out from PIL, it takes longer to write & debug, but something that takes PIL 60 seconds will take less than 1 second using numpy.

Most of my serious optimization efforts in C++ have ended up feeling very similar to the PIL vs numpy issue, and what happens is that it takes a ton of effort to optimize the right way because I have to invert my whole program's structure. When I've done that only to discover I didn't optimize the right thing, it's a huge mess to un-invert and re-invert the right way.

> I've been amazed what the top engineers in the field can design and implement getting things right the first time without additional effort. Simple, minimalist, high performance implementations that don't sacrifice much.

Same here, some people seem to hit the right balance with less effort. Sometimes it's experience and good guesses, but often (from what I've seen) it's because if you watch the best engineers work, they spend more time communicating up front to make sure they're doing what's really needed, and they spend more time checking their assumptions as they go, writing tests, profiling, and talking with their peers and their management about what they're doing. They're able to recognize quicker when they're spinning their wheels on problems they want to solve, and not problems that the team or product really truly needs solved.

Re:How much your computer can do in a second by jdblair on Sunday March 26, 2017 @01:14PM (#13961797)
Its always about making the right judgement call between optimization and complexity, and sometimes I'm still surprised by what needs optimized and what doesn't.

An anecdote from a project I'm working on. I'm writing some LED control software for light shows and using GPIO pins on various embedded Linux boards (CHiP, Raspberry Pi, Orange Pi) to generate the SPIO-like serial signal I need.

My first draft, for Raspberry Pi 3, is a wonder of compact bit twiddling, doing all the necessary operations to write to GPIO memory in one compact function.

For the second platform, the Orange Pi Zero, I found a Python library for GPIO access that someone had already written, saw that the gpio operations were broken out into separate files and pulled those files into my project. My first thought: this will never be fast enough, and the O-Pi Zero is slower than the R-Pi 3. Luckily, I decided to try it first.

Now the the gory details of writing to memory are hidden in the library and the logic in my code to generate clock pulses and write bits is a lot more clear. I had to tune the code differently - the delays in my code to generate the correct clock pulse width are shorter now that there is function call overhead, but that was easy to sort out with a bit of trial-and-error with a logic analyzer.

Re:How much your computer can do in a second by dahart on Sunday March 26, 2017 @01:33PM (#13961897)
> I'm still surprised by what needs optimized and what doesn't.

Yes! Exactly. I'm almost always surprised. And it's really important to remember what benefits you get from the unoptimized code too.

Once I wrote a controller input system in a game engine, the code that monitors and reacts to all the buttons on an xbox controller, for example. I spent a whole bunch of time making sure that when I hit X, the reaction code would trigger with almost no overhead at all. It did fancy stuff like watch for combos and sequences, and game designers could author the control schemes, and I spent a lot of time making sure that actions cost no CPU time.

Then one day I profiled it carefully and found out that the bottleneck was something I'd forgotten to check for -- the case when no buttons were being used. The case that is happening during 99.5% of frames.

The loop to check if something needed to be done had a pretty bad memory access pattern than was missing cache most of the time. I thought it would be close to a no-op, but it wasn't. I had to refactor the whole thing and flip it inside out, and I realized I'd wasted a bunch of dev time fixing the code that reacts to one button at a time. It doesn't matter how slow a single action is, because it'll never show up in the profile. It does matter if I waste a few hundred thousand cycles traipsing through memory missing cache with every instruction.

Re:How much your computer can do in a second by jdblair on Sunday March 26, 2017 @01:28PM (#13961869)
Something else I've learned the hard way - sometimes its better to cut and paste the same short code snippet in multiple places than create an abstraction to put the code in one place. I admit this is probably an indication there's a problem in the overall design, but sometimes those design choices have already been made and the goal is to make things work with what I have.
Re:How much your computer can do in a second by jfim on Sunday March 26, 2017 @04:32PM (#13963101)
> Something else I've learned the hard way - sometimes its better to cut and paste the same short code snippet in multiple places than create an abstraction to put the code in one place.

It's a pretty short term optimization though.

Sure, it'll get you working, but working on a code base with no duplication means that once you find a bug and fix it, you don't need to hunt for duplicates to fix. It also means that if you're debugging something, you know exactly which code path was taken instead of "oh I thought it using X but it's using slightly different Y."

Whether that's a good trade off or not really depends on how long this code will be maintained. If it's front end glue code that will be tossed out when the CEO decides in nine months that the website should use X technology instead, then yeah, that's a fair trade off. Much less so if you know this code will be there 5-10 years down the line.

Re:How much your computer can do in a second by devwastaken on Sunday March 26, 2017 @12:28PM (#13961541)
>I find premature optimization to be far, far more wasteful of money and human energy than wasted CPU cycles.

I would argue this always depends upon what you're doing. For example, in webdev, the culture of prototype fast and break things fast is very abundant, and makes sense when you're just trying to figure out if what you want done is even possible. However, there are many times where you /do/ have to consider the performance impact, because with it, what you're making isn't going to be nice to use.

By dogmatic, I think they meant individuals who will actually argue that '100ms' loop times are 'tiny' and shouldn't be a problem. They don't get the concept that its just one small part of your code, and the rest of it combined can make an entire process take up to 5-10 seconds to do something that should be in a blink or two. Learning about optimization is a part of learning programming, and knowing when to use it. The problem is when you don't know it, and fumble around trying to do so when you've got much bigger problems further ahead.

I ran into this problem a lot with image filtering and working with Canvas's to build an image editor. I talked with some communities about the Uint32Array implimentation in chrome and other browsers and how some of the ES6 goodies, like 'let', are actually bad practice when you start to get into image filtering, because just iterating over all the pixels in an image by using "for(let i=0;i< pixel.length;i++){}" is 3x slower than using var, causing just a single full loop to be 80-120ms on a good computer.

TypeScript compiles down to var, though, so its less of a problem there, but I met a lot of resistance in that statement in general, even though its true, because there's a lot of dogmatism in programming. At the end of the day I'd rather learn and teach good practices and not tell people they're pre-optimizing unless they really don't know much about what they're working with.

Re:How much your computer can do in a second by dahart on Sunday March 26, 2017 @01:08PM (#13961760)
> ES6 goodies, like 'let', are actually bad practice...

BTW, this is a really good example of why people like to avoid premature optimization.

Performance oriented code frequently has to break all the rules, it often goes against all "best practices" for code that isn't performance critical. If you do it too early, you will wreck your codebase's ability to deal with 1- non performance critical code and 2- other performance issues than the one you solved.

If you make it a rule to avoid using 'let' everywhere, then you lose the safety mechanism of block scope variables, something that a lot of people agree is a good idea.

It's very easy when you find out that let is 3x slower to stop using let, but then if you do that you're prematurely optimizing everything. And if you don't do it, everything you write is a little slower than it could be, and that will nag at you.

Functional programming is another good example of what many many people consider a good idea for code safety, and yet it is frequently abysmal for performance. Just to use another JavaScript example... using map() has historically been about 10x slower than using a for loop.

The singularly smartest engineer I know, who's now managing a huge team at NVIDIA, said to me that engineering for features is a solved problem, but engineering for performance is an unsolved problem. We know how to do class hierarchies and architecture and pub-sub systems to make a 10M LOC application manageable. We don't know how to write high performance code on that scale.

Re:How much your computer can do in a second by devwastaken on Sunday March 26, 2017 @02:55PM (#13962415)
>If you make it a rule to avoid using 'let' everywhere, then you lose the safety mechanism of block scope variables, something that a lot of people agree is a good idea.

Which is why I said its bad practice in specific cases, currently. 2.5 Million iterations is a use case, not a general rule.

Programming is complicated, and as such you should know not to make the assumption that a use case isn't going to apply everywhere. Rather, you can say that microseconds of performance difference aren't a good reason to not use let, unless, you're not using something that compiles down to var, and you're going into the millions of iterations.

But, the point I was trying to make is that even when you talk about performance problems, devs jump the gun to 'pre-optimization', partially because they themselves don't know how well code performs, and partially because of misapplied dogmatism.

Re:How much your computer can do in a second by dTal on Monday March 27, 2017 @07:41AM (#13966821)
>using map() has historically been about 10x slower than using a for loop.

Wow, really? Any idea why? Seems odd when map() imposes fewer guarantees and can be implemented, in the worst case, with a for() loop...

Re:How much your computer can do in a second by dahart on Monday March 27, 2017 @01:56PM (#13970079)
I don't really know why, and I have heard there are large discrepancies from browser to browser. It is a function call per iteration, or even a closure, so I'm guessing it may often be difficult to recognize and optimize out the function call, or maybe some browsers haven't gotten around to it yet, I don't know.

This also depends on what you're comparing. Map always allocates a new array. In my Chrome 57 right now, map() is 4x slower than new array + a for loop of push().

But it's 100x faster to re-use an existing array... (a for loop of array element assignment)

Re:How much your computer can do in a second by dahart on Sunday March 26, 2017 @12:50PM (#13961653)
> some of the ES6 goodies, like 'let', are actually bad practice... 3x slower than using var

This is good to know! I suspected, but never verified. I assume this will get fixed over time, since 'let' is brand new.

But JavaScript in general isn't well suited to image filtering, right? Certainly worth using, if at all possible, either CSS filtering or WebGL. Either of those will be much faster. Depending on what you're doing, some complex filtering operations will even be faster to upload to a back-end, process, and download the result. :P Is WebGL something you avoided because it won't work for you, or something you avoided because it's more costly development wise?

Hey overall, I agree with everything you say, and I'm still comfortable saying, dogmatically, never optimize prematurely. What that means to me is don't do engineering for problems you don't know you have. If you're not sure, then you don't know. If you're doing filtering, and napkin math proves in advance that you can't beat 5fps and your requirements call for 15 fps, then you do know.

In my mind this even fits with startups, because a startup's mission is to find the product and market, to figure out what's possible and then execute on it.

So ultimately I agree 100% it always depends on what you're doing, my additional caveat is always know what you're doing. :)

Re:How much your computer can do in a second by devwastaken on Sunday March 26, 2017 @02:46PM (#13962362)
>either CSS filtering or WebGL

CSS only has basic filters, and WebGL is only possible for per-pixel manipulation, such as brightness or contrast. This is because WebGL is just shaders, and half of shaders are per-pixel, along with some other fun things you can use with multiple buffers, but you can't actually get /back/ the processed data even if you got all the pixels into a single loop. With WebGL 2, this may be different due to some new buffer types, but I don't think its made for it. Any time you do an algorithm that is dependent upon surrounding pixels, such as dithering, you're stuck with JS.

https://tools.czaux.com/space-pixels/

Here's an example of in-browser dithering to a fixed palette set that works pretty well, using RGBQuant modified with alpha support. The overall canvas uses FabricJS for manipulation.

Re:How much your computer can do in a second by dahart on Sunday March 26, 2017 @03:38PM (#13962711)
> but you can't actually get /back/ the processed data even if you got all the pixels into a single loop

Oh if you need the pixels back, you can certainly get them using glReadPixels(). It's a bit expensive in WebGL land, though it is much less expensive than looping over pixels using JS. And often there are ways to get around needing the pixels back, depending on what you're doing.

You can also do loads of non per-pixel tricks, including filters that need the surround, using multiple passes and clever shaders, you are not as limited with WebGL 1 as you think.

https://5013.es/toys/dithering/

https://www.shadertoy.com/view/MslGR8

This is what I'm talking about, you have to slice your program differently if you optimize it. Your high level structure and outermost loops will look different if you use WebGL instead of JS. And yes WebGL 2 is even better.

But, this is all much trickier than writing your straightforward loops in JS. That's the price you pay for performance, your architecture will be kinda crazy if you do it in WebGL, and it will not be easy to go back if you discover you optimized for the wrong thing.

Re:How much your computer can do in a second by devwastaken on Sunday March 26, 2017 @06:01PM (#13963559)
Random-order dithering can be done in WebGL, but they are of poor quality. I am talking about error-diffusion dithering, where you are reading and writing pixels, and then re-reading those modified pixels that change the rest of the pixels. In WebGL, you can read the pixels of the image, but you cannot modify and read. You are returning the actual pixel you have modified, which is what glReadPixels() returns. You could use webgl, but you'd have to use glReadPixels() for every pixel modified so that the next pixel knows the new data.
Re:How much your computer can do in a second by dahart on Sunday March 26, 2017 @07:03PM (#13963875)
Yes, ordered dither is easier in a shader than error diffusion, that's true, but error diffusion is definitely possible on a GPU. If you need it. Do you really need it? Why not still use the GPU to accelerate whatever parts you can? Even if you dither on the CPU, doing your color filters on the GPU instead of in JS could make the difference between interactive and not.

I don't know what you're doing exactly, but when you do need dithering, it's usually the last thing you need to do before output, and it's usually less important that the dither is fast than most other operations you need in an image editor.

BTW, random order is lower quality, and error diffusion is better, only for for very low res color palettes. If your result is more than 256 colors, it's irrelevant, and for high quality dithering, e.g., 16 bits per channel colors to 8 bits per channel for print, random ordered dithering is superior.

https://community.arm.com/graphics/b/blog/posts/when-paralle...

http://www.cs.cmu.edu/~imisra/projects/dithering/HybridDithe...

https://www.shadertoy.com/view/4dt3W7

That last one is ugly, but it's a great proof of concept here. You could get error diffusion in a shader using 2 passes. The first pass you render to texture, and the second pass, you can sample the texture however you want. Note how in this example, the error diffusion propagates backwards from what you would normally do in JS or C++, because it's a shader looping over destination pixels, not code that loops over source pixels.

> In WebGL, you can read the pixels of the image, but you cannot modify and read.

I don't know exactly what you mean here. You can modify & read pixels using render to texture, or using multiple passes.

Render to texture will be faster, if you can do it. Multiple round-trips from CPU to GPU and back will be slower, so you want to limit the number of trips, but it's easy to do.

Re:How much your computer can do in a second by devwastaken on Sunday March 26, 2017 @10:16PM (#13964635)
>Even if you dither on the CPU, doing your color filters on the GPU instead of in JS could make the difference between interactive and not.

Dithering requires quantization. If you mean things like brightness and contrast, yes, webgl is better for that. But quantization with error diffusion dithering is still based upon previous modified pixels, so you cannot just send a bunch of pixel info to webgl, you have to do each pixel seperately. Meaning, pushing through 2.5Million seperate inputs sequentially, and having to use glReadPixels() 2.5Million times.

>BTW, random order is lower quality, and error diffusion is better, only for for very low res color palettes.

Not in any of the images I have used. Ordered dithering looks fake, because it appears like a texture to the image. Dithering with error diffusion kernels, like Floyd-Steinberg create a less obvious texturization that still preserves the underlying image.

>https://www.shadertoy.com/view/4dt3W7

From what I'm reading, for every pixel, it is processing a 250 iteration loop that gets the pixels in the row and builds errors based upon those. However, it is not modifying any pixels as it goes, this is a parallel operation independent of each other. Good error diffusion with a kernel requires previous pixels to be modified, and errors to be built upon them, which is why it is a sequential operation. I don't see any destination-dependant pixel manipulation.

>Multiple round-trips from CPU to GPU and back will be slower, so you want to limit the number of trips, but it's easy to do.

If its possible to get data back from Uniform Buffer Objects in WebGL2, it may be possible to send up to 1000 or so uniform pixel values, but that is the general cap. Some GPU's have less. Unless I am missing some magic buffer you can use to write out many pixels too, and in that case I would be very interested in testing that, but shaders are designed to output a single pixel per instance.

>https://community.arm.com/graphics/b/blog/posts/when-paralle...

From what I'm reading, this is using OpenCL, and parrallelizing in rows, but these rows have height. A single thread processes one row and sequentially goes through the pixels like normal error diffusion. Just that this breaks different parts of the image up. I may have to try this out in JS and see if perhaps it can thread better that way. ty.

Re:How much your computer can do in a second by dahart on Sunday March 26, 2017 @11:35PM (#13964971)
> so you cannot just send a bunch of pixel info to webgl, you have to do each pixel seperately.

Why do you think that? You certainly can get previously modified pixels, you can send millions of pixels to WebGL with a single call (as a texture). Nobody calls glReadPixels millions of times, that's a bad idea. :) You might want to investigate multipass rendering techniques. Small kernel convolutions, for example, are standard and simple operations in WebGL. People use blur & edge filters all the time, and those depend on neighborhood computation.

Regarding the 1-d error diffusion shader on shadertoy, it is using a gather instead of a scatter. It's a pull instead of a push, he flipped the operation inside-out. It is still computing error diffusion correctly (but for only a single pixel row). And it's running at 60fps.

This is the whole point I tried to make above multiple times wrt performance: this code looks unrecognizable compared to the straightforward CPU serial way to implement error diffusion.

The reason this example is correct (in 1D) is because it recomputes the error propagation for every destination pixel; it's wasting almost all of the computation it's doing because in this case it's not sharing the error computation. But that doesn't mean it can't -- this is just a proof of concept on ShaderToy, not the limit of what you can do. You can't do multipass with ShaderToy, and multipass is how you share pixel results from one iteration to the next.

> Unless I am missing some magic buffer you can use to write out many pixels to

It sounds like you're missing render to texture and multipass techniques, the ways to use textures as compute I/O. To do multipass in WebGL and share the results of computation from one pass to the next, you create an offscreen framebuffer for your results, and you render directly to that framebuffer. You can then use the result as an input texture for the next pass (via glCopyTexImage2D) or you can read back the buffer (via glReadPixels) and then you repeat. Using glCopyTexImage2D is much faster because you never leave the GPU.

I think you could do error diffusion by rendering the error to a texture, and using a multipass technique that only needs as many iterations as the maximum distance any error could travel. In the worst case it'd probably be the greater of your image width or image height, e.g. 512 passes for a 512x512 image, but in practice I think you'd be done much sooner. That's assuming there isn't something hierarchical and more clever that could do it in log(width) passes, which I suspect there is.

Re:How much your computer can do in a second by devwastaken on Monday March 27, 2017 @02:10AM (#13965523)
>It sounds like you're missing render to texture and multipass techniques, the ways to use textures as compute I/O. To do multipass in WebGL and share the results of computation from one pass to the next, you create an offscreen framebuffer for your results, and you render directly to that framebuffer. You can then use the result as an input texture for the next pass (via glCopyTexImage2D) or you can read back the buffer (via glReadPixels) and then you repeat. Using glCopyTexImage2D is much faster because you never leave the GPU.

How are you writing many pixels to a framebuffer in a single instance? frag_color returns one pixel. Even if that OpenCL implimentation works in webgl, you'd still be at only 8 threads, so only 8 pixels that can be done at the same time, then you have to pass in the output to process again. 259200 glCopyTexImage2D calls for a 1920x1080 image since its 2073600 pixels.

I'll definetely look into this more, since that openCL implimentation might hold some answers on how the error distance is seperated to allow for 8 rows at a time.

Re:How much your computer can do in a second by dahart on Monday March 27, 2017 @03:04AM (#13965694)
> frag_color returns one pixel

Whoa, hang on. Hey I only mean this to be helpful not insulting, but it sounds to me like you may have some misconceptions about the way WebGL works. I know how easily that can be taken the wrong way, especially in text, so again I apologize in advance and I don't mean that to be rude at all. It would be best to back up and understand WebGL.

If you're doing image processing in WebGL, then to write many pixels to a framebuffer all at once, you draw a single polygon that covers the entire viewport. Your shader is applied in parallel to all pixels drawn. That is how ShaderToy works, it renders a single quad to the viewport and applies whatever shader you give it, the GPU runs that shader on all pixels rendered.

There are never hundreds of thousands of buffer read calls, you only need a handful. For a blur, you only have to do a buffer read once, and your shader samples the 3x3 neighbor pixels.

You don't need OpenCL, that's a level of complication you don't need. I may have given the wrong impression with that link.

Check out this image processing tutorial using basic WebGL 1, and pay attention to how it works:

https://webglfundamentals.org/webgl/lessons/webgl-image-proc...

Here is the demo from that article that uses the techniques I've been talking about. All of the filters in this demo are doing neighborhood computations. And note you can apply multiple filters. There is no texture copy here, this tutorial renders directly to a texture in one pass, and then samples that texture in the next pass and so on. The iterations or feedback that you're looking for happen by combining render-to-texture with drawing the viewport polygon multiple times.

https://webglfundamentals.org/webgl/webgl-2d-image-processin...

Re:How much your computer can do in a second by devwastaken on Monday March 27, 2017 @10:01AM (#13967751)
>If you're doing image processing in WebGL, then to write many pixels to a framebuffer all at once, you draw a single polygon that covers the entire viewport. Your shader is applied in parallel to all pixels drawn. That is how ShaderToy works, it renders a single quad to the viewport and applies whatever shader you give it, the GPU runs that shader on all pixels rendered.

>Whoa, hang on. Hey I only mean this to be helpful not insulting, but it sounds to me like you may have some misconceptions about the way WebGL works.

You draw a simple quad, which the shader then processes all the pixels in parallel, returning their frag_color as the output color. It can read textures and other source information, but it does not have access to what is being processed currently for other pixels, because its parallel. You have to wait until it has rendered that, and then pass it in again. I am unsure what I am misunderstanding.

>https://webglfundamentals.org/webgl/lessons/webgl-image-proc...

This was a cool insight into using framebuffers for multiple passes, thank you.

>Here is the demo from that article that uses the techniques I've been talking about. All of the filters in this demo are doing neighborhood computations. And note you can apply multiple filters. There is no texture copy here, this tutorial renders directly to a texture in one pass, and then samples that texture in the next pass and so on. The iterations or feedback that you're looking for happen by combining render-to-texture with drawing the viewport polygon multiple times.

From what I'm seeing, this is not just a couple passes, its a pass per-filter. None of the filters singularly rely upon multiple passes, their output is calculated purely on the image that was filtered before it, meaning the filter itself doesn't need to write pixels and then read them again. You can see that in the for loop that calls setFramebuffer() and drawKernel(). I understand that you can apply a shader, and put its output back in, but I still fail to see how you're avoiding doing that at the very least in the hundreds of thousands of times. error diffusion dithering classically is sequential from top to bottom, or bottom to top depending upon serpentine or not, I don't think you can just process a ton of pixels at the same time and still look anything like a sequentially done Floyd-Steinberg.

Re:How much your computer can do in a second by dahart on Monday March 27, 2017 @12:12PM (#13968921)
Okay, this is good, you're almost there. BTW, I'm doing a bad job of explaining, and I'm sorry. I realize I'm complicating a few things and conflating a few things, so the best advice I can give is to actually go through that tutorial on image processing and write the code and understand the whole pipeline.

You're right; this demo is 1 pass per filter type. None of them require multipass, but the entire demo is multipass. There could be a filter that needed more than 1 pass, but in this case there isn't.

1 pass means: render all pixels in the viewport, and run the shader on all pixels rendered. You've got that part. The trick is you get to access a texture, and the texture is the result of the previous pass. Furthermore, inside the shader, you can address and access any pixels from the previous pass, and you can access multiple pixels from the previous pass to render one destination pixel.

I think the millions of reads you're looking for are the texture() calls happening inside the shader. The [render / render-to-texture / copy pixels / copy texture image] calls process all pixels in the viewport in a single call. The shader applies to all pixels, but a shader only gets to touch any given destination pixel once per render. But the shader can read as many source pixels as it wants.

Because the shaders aren't limited on their reads, but they are limited on their writes, you have to re-organize your algorithm accordingly. You keep reiterating that error diffusion is spreading out from top to bottom, and I keep re-iterating that it has to work differently in WebGL, we've been talking past each other a little bit here.

You're right; you can't spread things out (scatter) using WebGL during a single pass, you can't do the classic Floyd Steinberg implementation the same way you do on the CPU. So it's important to understand that there is another way to do it, and it doesn't look like what you're used to. It doesn't spread things out by pushing error around inside the loop. It spreads things out by letting each destination pixel pull the error from it's neighbors before computing it's own error, rather than pushing it's own error to it's neighbors after computing. This is known as a gather, as opposed to scatter. It is mathematically the same thing, but the order of operations is turned around.

Here's a diffusion demo, it's reaction diffusion, not error diffusion, but ultimately exactly the same diffusion process. Each pass diffuses the previous pass by 1 step.

http://timhutton.github.io/webgl-reaction-diffusion/

Re:How much your computer can do in a second by devwastaken on Monday March 27, 2017 @04:18PM (#13971334)
>You're right; you can't spread things out (scatter) using WebGL during a single pass, you can't do the classic Floyd Steinberg implementation the same way you do on the CPU. So it's important to understand that there is another way to do it, and it doesn't look like what you're used to. It doesn't spread things out by pushing error around inside the loop. It spreads things out by letting each destination pixel pull the error from it's neighbors before computing it's own error, rather than pushing it's own error to it's neighbors after computing. This is known as a gather, as opposed to scatter. It is mathematically the same thing, but the order of operations is turned around.

That makes significantly more sense now. I thought you were saying I could do normal floyd-steinberg sequentially somehow.

I am unsure on the mathematical implimentation, but I will keep looking at this. I would think there would be a paper on this method somewhere.

I really appreciate the time you've taken to respond. Not many webgl people out there that can actually point out how it all works and whats possible, and I definitely learned something.

Re:How much your computer can do in a second by the8472 on Sunday March 26, 2017 @02:34PM (#13962290)
> because just iterating over all the pixels in an image by using "for(let i=0;i< pixel.length;i++){}" is 3x slower than using var, causing just a single full loop to be 80-120ms on a good computer.

That is an implementation detail. Of specific chrome versions.

That does not make let itself bad practice. In principle it should be significantly easier to optimize for a compiler because its more limited scope. So in the long run or possibly on other browsers it is likely best practice.

Putting transients before long-term behavior leads to urban programming myths and legacy baggage.

In fact in some jsperf benchmarks on chromium let happens to be faster for me.

Re:How much your computer can do in a second by devwastaken on Sunday March 26, 2017 @02:50PM (#13962386)
>Putting transients before long-term behavior leads to urban programming myths and legacy baggage.

Not when the problems still exist. When they stop existing, sure, but the statement generally goes along with how some parts of ES6 are not well optimized yet. Over time, they should be optimized, but I cannot design something for an event that hasn't happened yet and cannot be tested.

Re:How much your computer can do in a second by lederhosen on Sunday March 26, 2017 @05:03PM (#13963286)
You are doing it wrong.

let is better than var (in every way), so you should never ever use var. Of course you can design for the future. Designing for the future is using let and transpile to a dialect that is used by most browsers today.

Re:How much your computer can do in a second by devwastaken on Sunday March 26, 2017 @06:03PM (#13963571)
>let is better than var (in every way), so you should never ever use var.

Not in the case I presented. let has benefits, but that does not mean its 'better in every way'. Again, dogmatism. Granted, the case I give is many, many iterations, it still is a problem if you're doing image filtering.

Re:How much your computer can do in a second by Athas on Sunday March 26, 2017 @12:21PM (#13961497)
> Computers are fast, but not if all that speed is wasted.

While computers are fast, the performance improvements have been spread very unevenly. CPUs have improved the most, with memory lagging significantly behind, and persistent storage even more distant. On the other hand, networks have become much faster than before. I like this list of Latency Numbers Every Programmer Should Know: https://gist.github.com/jboner/2841832

Re:How much your computer can do in a second by matt4077 on Sunday March 26, 2017 @01:51PM (#13962020)
Is that still true? I would think that the rise of SSD means persistent storage has improved much more CPU, at least in the last decade or so.
Re:How much your computer can do in a second by Athas on Sunday March 26, 2017 @02:09PM (#13962133)
Not really, it's just another example of uneven performance improvements. Peak CPU performance has increased massively, but achieving it requires the use of vector instructions (and multiple cores). It is true that the speed of persistent storage has increased faster than sequential CPU performance (but it's still quite far off).
Re:How much your computer can do in a second by seanp2k2 on Sunday March 26, 2017 @04:46PM (#13963180)
Or it can blink a cursor https://news.ycombinator.com/item?id=13940014

I remember an early Atom extension which faded the cursor in and out. It used 100% of one core to accomplish this.

Re:How much your computer can do in a second by ska on Monday March 27, 2017 @09:01AM (#13967303)
You're nearly right: but premature optimization is no myth, but a massive source of both bugs and wasted effort.

The backlash (e.g. your statement?) against it's misapplication seems to be causing as many problems today as the misapplication, at least in my experience.

It is true that "premature optimization" is used as an (invalid) excuse for lack of or poor design, but if wasn't there another excuse would be found. That's not what Knuth was talking about.

Re:How much your computer can do in a second by DonaldFisk on Monday March 27, 2017 @06:18AM (#13966417)
Re:How much your computer can do in a second by woliveirajr on Monday March 27, 2017 @11:40AM (#13968604)
That made me remember when I was learning to program (Clipper anyone?). How fast Clipper (compiled) was when comparing to dBase III PLus.

And made me wonder: for small applications, like the traditional one computer that controls my sales, nothing online... which language would I use? Seems that there are many options for big systems, buj WebServer + Java + (...) seems to be too complex (and slow) for small needs.

Re:How much your computer can do in a second by jackmott on Sunday March 26, 2017 @05:48PM (#13963501)
well most of the examples are in interpreted python which would be one of those bad design choices.
Re:How much your computer can do in a second by pekk on Sunday March 26, 2017 @01:11PM (#13961778)
Do you know how much you could do in a month but can't because of bad design choices, overengineered type systems, and dogmatic adherence to the 'every application needs to be written in the language with the best benchmark numbers' myth?
Re:How much your computer can do in a second by mwcampbell on Sunday March 26, 2017 @01:22PM (#13961833)
False dichotomy. The real solution is a language with a strong, static type system (and thus plenty of room for ahead-of-time optimization) that's also concise and productive, such as Kotlin or Swift.