Live data from Hacker News

The compiler will optimize that away

blog.royalsloth.eu

131–140 of 329 posts

Re: The compiler will optimize that away

#131

Why aren’t hardware designers designing hardware for the languages and methods we have?

There are physical limits. E.g. clock speed can’t go so high that information must travel across the cpu faster than the speed of light. E.g.2. As caches get bigger, it takes more time to index them.

Re: The compiler will optimize that away

#132
post #6

> 4. Data oriented way of programming has its own set of problems. This should be a top reason. Author is too shy to reveal the true cause.

Data oriented programming isn't a framework or paradigm. It's simply a principle that says that programs should be written to solve particular problems on particular hardware. If objects serve a purpose to this end, then they are also data oriented programming.

Re: The compiler will optimize that away

#133

Earlier quoted context omitted.

I disagree. Almost all software I use these days is absurdly slower than it should be and probably a massive drain on collective productivity. I have ssd, fast internet, 64gb ddr4 etc, almost everything I do should be impercetibly instant but instead takes seconds and even minutes. Yeah of course most of that slowness is not even because of ignorance of the low level stuff but complete disregard of performance aspect…

Shit is slower than it was in the 90s. Spotify is slower than Winamp, Slack is slower than IRC, Webmail is slower than my e-mail client, VS Code is slower than Visual C++ 6.0.

People forget that Winamp was instant on a 60Mhz machine with a spinning rust drive. It’s difficult to buy a computer that slow these days. Modern CPUs modulate their speeds by far more than that as part of their moment by moment power management!

Re: The compiler will optimize that away

#134
post #124

Earlier quoted context omitted.

You're both right - but about different kinds of software. I believe the GP post was thinking an application which has some heavy computational kernel to it, where most of the processor time (and other resources) are spent - with a lot of other code for UI, configuration, some parsing etc. And you seem to be talking about everyday desktop applications: Browser, mail client, word processor, instant messaging client, a…

I spent years optimizing physics simulations from different domains (weather, fluid dynamics, all sorts of stuff). Even there you have to carefully pick the parts you want to optimize to get the best outcome for the resources you invest in optimization. It's completely infeasible to make everything crazy fast with a blanket approach.

You're speaking directly past your parent's point. I've spent years optimizing physics simulations, more abstract discrete math stuff, etc. myself. There, especially there, it's usually pretty easy to identify what should be the hot loop, by eye. Easier with a profiler if the project gets big. In scientific computing, it's very common to find that 99% of the time is spent on a scant few lines of code. Unless somebody bungs up the I/O and you end up spending 99% of the time there instead, but I digress.

But a whole OS, with a browser, network stack, dozens of applcations, etc., it's pretty common to find hundreds or thousands of things which are all more or less equally sucking performance. So on one hand, it's a much harder problem. On the other hand, front-end people have this attitude that performance doesn't matter because hardware is fast enough and it's better to write in the most abstract language possible because changing diapers makes your hands smell gross.

Re: The compiler will optimize that away

#135
post #125

Earlier quoted context omitted.

Do you use browsers? Browser makers spend billions of dollars in engineering time making them "fast", with great results.

Browsers are fast, but the content they render is very slow.

These are related: the faster the browser and the typical internet connection is, the bigger sites will be (absent some force to prevent developers from spending the entirety of the new performance budget.)

Re: The compiler will optimize that away

#136

Earlier quoted context omitted.

I disagree. Almost all software I use these days is absurdly slower than it should be and probably a massive drain on collective productivity. I have ssd, fast internet, 64gb ddr4 etc, almost everything I do should be impercetibly instant but instead takes seconds and even minutes. Yeah of course most of that slowness is not even because of ignorance of the low level stuff but complete disregard of performance aspect…

Shit is slower than it was in the 90s. Spotify is slower than Winamp, Slack is slower than IRC, Webmail is slower than my e-mail client, VS Code is slower than Visual C++ 6.0.

Yeah, this is the weirdest thing to me: Windows NT 3.51 on a Pentium was much snappier perceptibly than even my new M1 MBP (developers are already expanding to the new performance envelope).

Re: The compiler will optimize that away

#137

Earlier quoted context omitted.

Shit is slower than it was in the 90s. Spotify is slower than Winamp, Slack is slower than IRC, Webmail is slower than my e-mail client, VS Code is slower than Visual C++ 6.0.

People forget that Winamp was instant on a 60Mhz machine with a spinning rust drive. It’s difficult to buy a computer that slow these days. Modern CPUs modulate their speeds by far more than that as part of their moment by moment power management!

Related: when MacBooks switched to SSDs, the performance of my old spinning-disk MBP dropped noticeably basically overnight.

Re: The compiler will optimize that away

#138

The metaprogramming available in languages like Rust and C++ could maybe be leveraged to make the struct-of-arrays model easier. Wouldn't be the same as native support, though.

There is some, lets call them experimental, C++ libraries for that. But C++ not having static reflection is the main show stopper on that frontier.

> There is some, lets call them experimental, C++ libraries for that.

Could you provide some links?

Re: The compiler will optimize that away

#139

Earlier quoted context omitted.

Shit is slower than it was in the 90s. Spotify is slower than Winamp, Slack is slower than IRC, Webmail is slower than my e-mail client, VS Code is slower than Visual C++ 6.0.

Yeah, this is the weirdest thing to me: Windows NT 3.51 on a Pentium was much snappier perceptibly than even my new M1 MBP (developers are already expanding to the new performance envelope).

Dan Luu has done some measurements around this:

https://danluu.com/input-lag/

https://danluu.com/term-latency/

Re: The compiler will optimize that away

#140
post #125

Earlier quoted context omitted.

Do you use browsers? Browser makers spend billions of dollars in engineering time making them "fast", with great results.

Browsers are fast, but the content they render is very slow.

Reminds me of the "paradox" that making technology more energy-efficient has the effect of increasing overall energy use.
Post reply on HN