Live data from Hacker News

The compiler will optimize that away

blog.royalsloth.eu

191–200 of 329 posts

Re: The compiler will optimize that away

#191
post #148

Earlier quoted context omitted.

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).

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 disabled (as far as I can tell) and still it's less snapy than this one Windows Server instance on comparable machine. (and sadly no single modern OS feels as snappy as even Windows XP SP2 for a similar level of functionality on not-so-recent hardware)

Re: The compiler will optimize that away

#192
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.

Re: The compiler will optimize that away

#193
post #45

Earlier quoted context omitted.

> Somehow over the years I've found that the animals/cars analogies given in OO tutorials are one of the few places that fit well with the model. Yes, and I've never actually needed to implement a cat or a cow in any project :) The other thing for which OO works much better than plain data is GUIs - and I think it is not a coincidence that OO popularity exploded together with the the coming-of-age of GUIs. The other…

> The other thing for which OO works much better than plain data is GUIs This cannot be further from my experience. Switching from Java/AWT/Swing to ClojureScript/Reagent/Re-frame has been suoer liberating. Every GUI programmer must fiddle with reagent once: https://reagent-project.github.io/

But you're super limited if you're trying to make a GUI inside a browser, how is this a good example ?

Re: The compiler will optimize that away

#194

Good article. My own thinking when coding performance is also towards data oriented approaches. For example Bevy in Rust. If stuff needs to be fast, it needs to be in cache. To do that, have everything nicely packed so you only ask for a chunk as often as you need. Then when you need it, it's already there. Thing about old fashioned OO is it's often fine enough for your run-of-the-mill CRUD app. If you look at the la…

You're talking like ECS and OOP are separate, while ECS is actually relational OOP : https://www.gamedev.net/blogs/entry/2265481-oop-is-dead-long...

Re: The compiler will optimize that away

#195
post #138

Earlier quoted context omitted.

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?

https://github.com/Yamahari/struct_array

It uses C++20 features and macros. The macros limit it to a POD count of 8.

Re: The compiler will optimize that away

#197
It's interesting that Java/JVM is both one of the worst cases and best here. When you work only with arrays of primitives its performance is shockingly good and aligns well with the needs for locality. Hopefully future improvements extend that to include structs/records and then it may actually be quite a powerful platform in this regard.

Re: The compiler will optimize that away

#198
post #4

Earlier quoted context omitted.

What do you mean by game-style here? I’m very intrigued. Any place to read more about these?

It's called entity-component systems in games. Note that OOP was designed for simulations but games, the only kind of simulation people like using, don't use OOP.

Plenty of games use OOP (C++ !). And ECS is just relational OOP.

Re: The compiler will optimize that away

#199

Earlier quoted context omitted.

> The key is that it doesn't use inheritance Cocoa is literally based on inheriting from NSView (which itself inherits from NSResponder) https://developer.apple.com/documentation/appkit/nsview

That's if you want to make a custom view, which very often you don't. Placing default views in a window and receiving events/values from them doesn't use inheritance, instead using composition and delegate patterns. UIKit lost some of the convenience features like bindings when it shrunk to fit on phones, which might be why people got annoyed enough to invent entirely new UI frameworks.

> That's if you want to make a custom view, which very often you don't.

I have never seen any non-trivial software not have custom-drawn widgets - grepping for `: NSView` in my ~ gives me a few thousand matches (and it's not even a mac)

> Placing default views in a window and receiving events/values from them doesn't use inheritance, instead using composition and delegate patterns.

... but you can't have composition without at least interface inheritance, and in this case you really want access to the parent methods & properties of NSView when creating your own widgets (e.g. bounds, rects, tooltips, etc) so you also want implementation inheritance.

Re: The compiler will optimize that away

#200
post #183

Earlier quoted context omitted.

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!

Winamp didn't stream all music in existence over the internet. How is it really comparable?

It's comparable only on an abstract level - mostly because there's hardly anybody who really wants/needs "all music in existence over the internet", most people just want to "listen to music that I like".

On that level, Winamp did the job just fine.

Post reply on HN