Live data from Hacker News

The compiler will optimize that away

blog.royalsloth.eu

211–220 of 329 posts

Re: The compiler will optimize that away

#211

Something I genuinely don't understand "buttery smooth 3D game"s are created with C++ too but why isn't C++ an issue for games? Seems to contradict the premise which is that programming languages were designed in the past and hence not efficient for modern computers.

If you use C++ in the "default" object-oriented way, your program won't be as efficient as it could've been. Computers are fast, so you can still make games which run well, but not as well as they could've been.

C++ can also be used in ways which are really fast on modern machines. You can, for example, write code in a data-oriented "struct of arrays" approach with C++. The argument is just that C++ isn't designed with that in mind, and that a high performance language designed today could be designed with modern machines in mind.

Re: The compiler will optimize that away

#212
post #191
post #148

Earlier quoted context omitted.

Windows Server 2019 has a much snappier UI then Windows 10 I've found (I recently spent a ton of time automating installs for both and boy did that become noticeable). Then you look at the Windows 10 list of crapware and it becomes a lot clearer.

Then you look at the Windows 10 list of crapware and it becomes a lot clearer. Is there an actual causal relationship? And which crapware specifically? Asking because I only have access to a bunch of Windows 10 Pro machines which already don't seem to have most of crapware on there (i.e. often I see threads here where people complain about all kinds of ads and other things I never even knew existed) and the rest disa…

The difference is the list of running background services. Kernel and drivers are the same, libraries are the same, but server doesn't have (ex) the AllJoyn Router Service for Smart Things Control, the 4G LTE Push Notifications Service, the WAP Push Message Service, the Fax Service, Windows Image Acquisition, and so on. Candy Crush doesn't run on startup, these do.

Re: The compiler will optimize that away

#214

Earlier quoted context omitted.

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

Same thing on Windows. It became incredibly slow on HDDs when SSDs started to become popular.

Having an Hdd running at 100% on Windows 8, slowing everything down, is actually what made me switch to Linux Mint. Never looked back.

Re: The compiler will optimize that away

#215
post #11

Earlier quoted context omitted.

> Instead, we should be using game-style "data oriented programming" a.k.a. "column databases" for a much higher performance. This makes logical sense, but I don’t buy it in practice. Most of the heavy data reads are handled by databases, which do optimize for this stuff. I just doubt that, in most software, a significant amount of software performance issues are a result of poor memory alignment of data structures.

Cache misses can lead to major slowdowns. Everything depends on the access patterns in critical loops. If you need most of the fields of a struct in each iteration, the classic way is beneficial. If you need a narrow subset (a "column") of fields in a large collection of objects, splitting objects into these columns speeds things up.

The most upvoted stackoverflow question is about branch prediction (which is caching in a way):

https://stackoverflow.com/questions/11227809/why-is-processi...

Re: The compiler will optimize that away

#216
post #44

Earlier quoted context omitted.

> If you imagine a game that has characters, relationships, items, spells, and so on, it's often not that easy to model as encapsulated objects. Does each character have a list of other characters that they have a relationship with? What happens when you want to change the relationship, or a character casts a spell that temporarily changes the relationship? Can easily end up a mess, because it's not obvious where suc…

That sounds like a poor man's component if you already separated it into another class...? And that data is no longer belonging to the instance now.

OOP based component approaches are really common so it shouldn't be surprising.

Re: The compiler will optimize that away

#217
post #125

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…

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

>"Browsers... "fast", with great results."

Are you joking?

I have seen progressively worse performance from even the best browsers, and page load times that should be instant often literally take minutes or never load unless I completely kill the browser process and return. The slowdown is nearly inexorable, with occasional improvements in some versions before resuming the dismal trend.

Simple word processing and spreadsheets are so laggy on keystrokes as to be almost unusable, and by unusable, unresponsive on a level hundreds of times worse than DECADES ago, on computers orders of magnitude less powerful. Simple cursor movements are so laggy that I must set aside my train of thought to attend to the tool.

And this is on a very solid CAD-level computer, FIOS connection, etc.

It is disgusting and unforgivable. I quit software career 15 years ago for a new industry in no small part because I saw this trend of ever more complex "tools" & "frameworks", etc. creating a situation of building castles on shifting sands, with serious declines in the ability to reason about debugging, performance, or security. It is only worse now, probably exponentially. Worse yet, it seems to have yielded no perceptable "programmer productivity".

It is one thing to architect and program to take advantage of upcoming advances in hardware. It is quite another thing to ignore it and assume that the hardware builders will save you from the bloatware that you foist on the world without a serious thought.

Re: The compiler will optimize that away

#219
If memory controller could be given a mask for what bits or bytes are wanted, then the memory overhead could be reduced without changing the representation in the programming language.

At that point the compiler can optimize memory access by generating the mask.

Re: The compiler will optimize that away

#220
post #219

If memory controller could be given a mask for what bits or bytes are wanted, then the memory overhead could be reduced without changing the representation in the programming language. At that point the compiler can optimize memory access by generating the mask.

If you had the opportunity to change the entire cache hierarchy at a hardware level and make all the compilers support that, you could do a lot of things.

You don't. You control the software.

Post reply on HN