Live data from Hacker News

The world could run on older hardware if software optimization was a priority

twitter.com

761–770 of 842 posts

Re: The world could run on older hardware if software optimization was a priority

#761
post #717

Earlier quoted context omitted.

> I want the choice to buy something that makes a dent in my electricity bill if I so choose to. Have you considered that the market for such a thing is effectively zero? Why would anyone make this? Dysons are fine, even if the founder is a total tool.

I was being hyperbolic throughout the entire post. Every-time you have a conversation around older stuff being better than newer stuff (some of this is due to regulation), you will have someone say their boutique item that costs hundreds of pounds (or maybe 1000s) works perfectly well. Ignoring the fact that most people don't wish to buy these boutique items (the dude literally talked about some Norwegian toilet desi…

> [Dysons] are rendered useless by cat fur

Patently untrue. Mine works fine.

Re: The world could run on older hardware if software optimization was a priority

#762
post #754
post #136

Earlier quoted context omitted.

Most programming languages are written in C, which doesn't. Fairly sure that was OP's point.

Secure string handling functions like strlcpy() and strlcat() do have bounds checks. Not everyone uses them sadly.

And that again, is the point. That stuff should be built-in and almost non-negotiable. It should be a lot more work to do the unsafe thing (see: Rust).

Re: The world could run on older hardware if software optimization was a priority

#763

Earlier quoted context omitted.

That's because TOTK is designed to run on it, with careful compromises and a lot of manual tuning. Nintendo comes up with a working game first and then adds the story - BotW/TotK are post-apocalyptic so they don't have to show you too many people on screen at once. The other way you can tell this is that both games have the same story even though one is a sequel! Like Ganon takes over the castle/Hyrule and then Link…

The framing device for The Legend of Zelda games is that it's a mythological cycle in which Link, Ganon, and Zelda are periodically reborn and the plot begins anew with new characters. It lets them be flexible with the setting, side quests, and characters as the series progresses and it's been selling games for just shy of forty years.

ToTK is a direct sequel to BoTW set a few years later and supposedly starring literally the same people though.

Re: The world could run on older hardware if software optimization was a priority

#764
post #762
post #754

Earlier quoted context omitted.

Secure string handling functions like strlcpy() and strlcat() do have bounds checks. Not everyone uses them sadly.

And that again, is the point. That stuff should be built-in and almost non-negotiable. It should be a lot more work to do the unsafe thing (see: Rust).

They are negotiable in Rust too. Just use the unsafe keyword everywhere. If you want to use a language where they are non-negotiable, use JavaScript.

Secure string functions are built into C these days. The older error prone ones are as well. You can ban the older functions from code bases, but it is hard to justify outright bans for all of them. If you audit string function usage in a non-trivial codebase, you likely will find instances where the old, error prone, string functions are used in safe ways and leaving them alone makes sense. This is particularly the case when constant length strings are used with constant length buffers. Here is an example where the old string functions are just as safe as the secure string functions:

https://github.com/openzfs/zfs/blob/master/etc/systemd/syste...

I found it when I audited the string function usage in OpenZFS with the goal of removing all uses of the older string functions. While I replaced every instance old string function where the secure string functions mitigated even the slightest risk, I could not bring myself to remove these, since there was nothing wrong with them. After my patches, a few string functions were then banned from the codebase with a build system hack put in place to break the build process if someone tried to reintroduce the banned functions.

Re: The world could run on older hardware if software optimization was a priority

#765

Earlier quoted context omitted.

I don't trust that shady-looking narrator. 5% of what exactly? Do you mean that testing for x >= start and Or would bounds checking in fact more than double the time to insert a bunch of ints separately into the array, testing where each one is being put? Or ... is there some gimmick to avoid all those individual checks, I don't know.

You only need to bounds check once before a for loop starts, not every iteration.

It depends on the loop. Here are a bunch of loops that need bounds checks on every loop iteration:

https://github.com/openzfs/zfs/commit/303678350a7253c7bee9d6...

You could argue otherwise and you would not be wrong since the codebase had not given this code inputs that would overrun the buffer. However, any case where you loop until the string is built needs a check on each iteration unless you can both prove that the buffer will always be long enough for any possible output and guarantee that future changes will preserve this property. The former is a pain (but doable) while the latter was infeasible, which is why the bounds checks were added.

That said, something as innocuous as printing a floating value could print 308 characters where you only expected 10 or less:

https://github.com/openzfs/zfs/commit/f954ea26a615cecc8573bb...

Edge cases causing things to print beyond what was expected are a good reason why people should use bounds checks when building strings, since truncation is fail safe, while overrunning the buffer is fail dangerous. I am a fan of the silent truncation done in both patches, since in both cases, truncation is harmless. For cases where silent truncation is not harmless, you can use detect the truncation by checking the return value of `snprintf()` and react accordingly. It should be said that the scnprintf() function's return value does not permit truncation detection and `snprintf()` should be used if you want that.

Note that I am the author of those two patches, so it is natural that I like the approach I used. They were written as part of an audit of the OpenZFS codebase I did when bug hunting for fun.

Re: The world could run on older hardware if software optimization was a priority

#766
post #67
post #12

I like to point out that since ~1980, computing power has increased about 1000X. If dynamic array bounds checking cost 5% (narrator: it is far less than that), and we turned it on everywhere, we could have computers that are just a mere 950X faster. If you went back in time to 1980 and offered the following choice: I'll give you a computer that runs 950X faster and doesn't have a huge class of memory safety vulnerabi…

I agree with the sentiment and analysis that most humans prefer short term gains over long term ones. One correction to your example, though. Dynamic bounds checking does not solve security. And we do not know of a way to solve security. So, the gains are not as crisp as you are making them seem.

> And we do not know of a way to solve security.

Security through compartmentalization approach actually works. Compare the number of CVEs of your favorite OS with those for Qubes OS: https://www.qubes-os.org/security/qsb/

Re: The world could run on older hardware if software optimization was a priority

#767
post #761

Earlier quoted context omitted.

I was being hyperbolic throughout the entire post. Every-time you have a conversation around older stuff being better than newer stuff (some of this is due to regulation), you will have someone say their boutique item that costs hundreds of pounds (or maybe 1000s) works perfectly well. Ignoring the fact that most people don't wish to buy these boutique items (the dude literally talked about some Norwegian toilet desi…

> [Dysons] are rendered useless by cat fur Patently untrue. Mine works fine.

Argh yes the "Works for me" argument. I suppose my mother was lying when she was complaining about it then? I will take her word for it rather than random internet user. So not it isn't patently untrue. I really dislike it when people try to gaslight me, on things that I have first hand experience with, so please don't do it.

BTW The old Henry Hoover (not bagless) never had any problems.

Re: The world could run on older hardware if software optimization was a priority

#768
post #12

I like to point out that since ~1980, computing power has increased about 1000X. If dynamic array bounds checking cost 5% (narrator: it is far less than that), and we turned it on everywhere, we could have computers that are just a mere 950X faster. If you went back in time to 1980 and offered the following choice: I'll give you a computer that runs 950X faster and doesn't have a huge class of memory safety vulnerabi…

I don't trust that shady-looking narrator. 5% of what exactly? Do you mean that testing for x >= start and Or would bounds checking in fact more than double the time to insert a bunch of ints separately into the array, testing where each one is being put? Or ... is there some gimmick to avoid all those individual checks, I don't know.

[deleted]

Re: The world could run on older hardware if software optimization was a priority

#769
post #741

Earlier quoted context omitted.

I literally had a new toilet put in a couple of years ago. It clogs pretty easily. So you just end up flushing it more, so you don't actually save any water. BTW the same thing happened with vacuum cleaners, you need to hover more to get the same amount of dust out because they capped the power in the EU. My old Vacuum Cleaner I managed to find, literally sticks to the carpet when hoovering.

Sorry to hear you got a bum toilet, luckily for you, there’s the other huge benefit of low flush toilets that I didn’t mention. Even with a total clog, there’s a 1-2 flush bowl capacity before it over flows. Who remembers the abject terror of watching the water rise in a clogged high flush toilet and just praying it didn’t overflow. Also unless every usage is a big poop requiring extra flushes, it’s far fetched that…

> Sorry to hear you got a bum toilet.

Firstly No my one works properly thank you. They just aren't as good as the old ones. Many of the plumbers have agreed with me on this.

> Who remembers the abject terror of watching the water rise in a clogged high flush toilet and just praying it didn’t overflow.

I don't remember the old ones clogging, because it rarely happened. So no I don't remember of this because it didn't happen that often.

> Your toilet might not have been seated right so the wax seal ring is partially blocking the sewer line.

It isn't fitted like that. I know because I took apart the old one (which was poorly installed). It quite frustrating on my end to read a post that when you make a bunch of assumptions about the fitting of my lavatory which are incorrect, while you are telling me I've got it all wrong.

Re: The world could run on older hardware if software optimization was a priority

#770

Earlier quoted context omitted.

Every Wednesday my PC becomes so slow it is barely usable. It is the Windows Defender scans. I tried doing a hack to put it on a lower priority but my hands are tied by IT.

Same. I had nearly full administrative privs on the laptop, yet I get "Access denied" trying to deprioritize the scan. We got new hardware recently, so we should be good until the scanners catch up and consume even more resources...

You basically have no control over it. I don't mind it doing a virus scan but could it do it out of hours.

People wonder why I don't run Windows outside of gaming and it because I don't really know what the system is doing anymore.

Post reply on HN