Live data from Hacker News

Making Reasonable Use of Computer Resources

vfoley.xyz

21–30 of 32 posts

Re: Making Reasonable Use of Computer Resources

#21
post #11

The author claims that making better use of the cache hierarchy and programming in a data oriented way will improve perceived performance for users. This isn't where we should start though. Much of the time bad performance comes from excessive I/O, bad algorithms and data structures (e. g. accidentally quadratic code), or misuse of third party libraries or services. Eliminating problems like this needs to come first…

A lot of poor performance in the wild comes from not batching operations that can be batched, thus increasing latency unnecessarily. Utilization of the CPU's cache line is just one instance of this problem. For example, imagine trying to parse a text file by literally reading one character at a time from the OS (literally issuing a 'read' command per character) vs reading the entire file upfront and then operating on…

> vs reading the entire file upfront and then operating on the text in memory.

What if you just mmap it?

Re: Making Reasonable Use of Computer Resources

#22
post #4

Saying programmers should "just do more work" is incredible economic naivety. Back in the day people dependencies were an obscure free software thing and everyone just rewrote the same shit against Microsoft's or AT&T's interfaces, with maybe some in-house libraries. People sucked at making and using abstractions, and didn't do it. Then the pendulum swung and people started being download all sorts of crap and everyt…

Ftfa > They can perform more operations in one second than a human could in one hundred years. Please identify the traffic lights. We suck at abstractions, but I think we’re still winning there.

I'm a bit confused about what you are saying. "Please identify where our abstractinos go wrong"? "Our abstractions are slowly getting better"? "Abstractions are bad but not for performance"?

Re: Making Reasonable Use of Computer Resources

#23
post #4

Earlier quoted context omitted.

Ftfa > They can perform more operations in one second than a human could in one hundred years. Please identify the traffic lights. We suck at abstractions, but I think we’re still winning there.

I'm a bit confused about what you are saying. "Please identify where our abstractinos go wrong"? "Our abstractions are slowly getting better"? "Abstractions are bad but not for performance"?

Ah, it was a late night quip with the intention of undermining the article.

Yes, computers are fast, but there's no underlying intention. Our abstractions aren't great, but I think our abstractions let us communicate intention in a way that computers are far far away from achieving.

Show a webpage with "identify all the traffic lights" to a child and, it might take a little while (especially if they can't read!) but the human will build up abstraction and leverage prior knowledge and solve the problem.

Show the same webpage to a supercomputer, and nothing will happen, ever. The supercomputer has access to all of the required information via the internet. Heck, the instructions are right there on the page. But there's no intention of solving the problem.

I guess, I'd say our abstractions do get better over time, but it can take a long time. an obvious example is Aristotle vs Newton vs Einstein. Computers haven't even started down that road. There are some vague ideas, and there has been concrete progress in narrow scopes.

I guess I had a somewhat emotional reaction to the criticism of "programs must be written for people to read, and only incidentally for machines to execute." Which lead me down a crazy tangent.

Performance matters, but only insofar as it helps people do stuff. But ultimately that's a people problem not a computer problem. The notion that computers are fast doesn't matter very much. We can use them more efficiently if we want to, but do we really want to? Who cares? Maybe it does make sense, maybe it's better to build a new feature.

Anyway, crazy tangent.

Re: Making Reasonable Use of Computer Resources

#24
post #18
post #12

Earlier quoted context omitted.

Deferring responsibility to other people is not a suitable attitude for a professional software engineer. There's a dangerous hidden assumption too in this mentality: the compiler is magic! It's not. The compiler mostly just does "micro optimizations" on the code. The most trivial example to demonstrate this is looping on a grid by column vs by row. The by-column iteration will be slower due to bad utilization of the…

> the most trivial example to demonstrate this is looping on a grid by column vs by row. The by-column iteration will be slower due to bad utilization of the CPU cache, and no compiler will ever rearrange the loop I think LLVM’s polyhedral optimization (Polly) probably will. I played with it a while back and found that if I handed it a naive matrix multiply with terrible locality, it was able to transform it to rearr…

> matrix multiply

probably one of the easy cases? I suppose the compiler must be able to somehow prove to itself that the code does not do anything else.

What if, for example, within the loop you "printf(column)" or something like that? In this case re-arranging the loop would produce a different result, wouldn't it? So the compiler probably will not optimize it in that case, would it?

Re: Making Reasonable Use of Computer Resources

#25
post #23

Earlier quoted context omitted.

I'm a bit confused about what you are saying. "Please identify where our abstractinos go wrong"? "Our abstractions are slowly getting better"? "Abstractions are bad but not for performance"?

Ah, it was a late night quip with the intention of undermining the article. Yes, computers are fast, but there's no underlying intention. Our abstractions aren't great, but I think our abstractions let us communicate intention in a way that computers are far far away from achieving. Show a webpage with "identify all the traffic lights" to a child and, it might take a little while (especially if they can't read!) but…

> I guess I had a somewhat emotional reaction to the criticism...

I agree wtith the rest of your post there.

> I think our abstractions let us communicate intention in a way that computers are far far away from achieving. > > Show a webpage with "identify all the traffic lights" to a child and, it might take a little while (especially if they can't read!) but the human will build up abstraction and leverage prior knowledge and solve the problem.

Ah. I don't measure progress using computers relative to the human brain. So when I say programmers are using bad abstractions, I am not envious of human pattern recognition etc. at all. Likewise natural language abstractions are messy and culturally loaded and so much more I don't want to get into.

When I say abstractions I am just talking about the rigid formal ones we program.

I think the field is too focused on A.I. stuff because of old romantic notions about human vs computer, piss poor education making programming knowledge scarce, and general laziness among the non-technical powers that be about defining the requirements. I don't think should be the main thread of how we use computers in society.

Re: Making Reasonable Use of Computer Resources

#26

This reminded me of Jai, the language by Jon Blow. In the Primer here: https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md , the section on Data-oriented design is relevant. Note that the bottom of the OP article mentions explicitly the games industry as caring about this; relevant given Blow's background.

This link is misleading and contains very outdated information.

Re: Making Reasonable Use of Computer Resources

#27
post #26

This reminded me of Jai, the language by Jon Blow. In the Primer here: https://github.com/BSVino/JaiPrimer/blob/master/JaiPrimer.md , the section on Data-oriented design is relevant. Note that the bottom of the OP article mentions explicitly the games industry as caring about this; relevant given Blow's background.

This link is misleading and contains very outdated information.

You're right - just noticed the note at the top. Do you know of a better and/or current synopsis?

Re: Making Reasonable Use of Computer Resources

#28
post #26

Earlier quoted context omitted.

This link is misleading and contains very outdated information.

You're right - just noticed the note at the top. Do you know of a better and/or current synopsis?

The new way Jai does SoA is through just userland macros: https://www.youtube.com/watch?v=zgoqZtu15kI

Tldr SoA isn't a single transformation. Depending on your data access pattern, you might want to shape the structure differently. Kinda like GPU. So first-classing a particular pattern of AoS->SoA conversion (the one we often see in tutorials) wouldn't have been enough. In this case, a little bit of tasteful usage of macros covers the variations well enough.

Re: Making Reasonable Use of Computer Resources

#29

Earlier quoted context omitted.

You're right - just noticed the note at the top. Do you know of a better and/or current synopsis?

The new way Jai does SoA is through just userland macros: https://www.youtube.com/watch?v=zgoqZtu15kI Tldr SoA isn't a single transformation. Depending on your data access pattern, you might want to shape the structure differently. Kinda like GPU. So first-classing a particular pattern of AoS->SoA conversion (the one we often see in tutorials) wouldn't have been enough. In this case, a little bit of tasteful usage of…

People focus too much on the SoA thing as if it was the whole point of the language, but it's really really not.

Jon does a lot of programming streams, and I think anyone who watches his programming streams will recognize that "structure of arrays" is not the default mode that he usually programs in.

That's not even the point of the language.

Yes the language does a lot of what you expect from a modern systems language: structs, explicit memory allocation and management, no header files, etc.

But as far as I can tell, this is just the bare minimum that you should expect from a modern systems language, and the ultimate goal of this language is not to just be that.

The best way I can think of to describe it is collapsing layers into just one: the language and its compiler.

This is why the language has meta programming and code generation built in.

I've seen talks where people boast about how they use a python script to generate a whole lot of C++ code!

I've seen projects written ostensibly in C++ but to build them you need download 10 different tools (including compilers or interpreters for other languages).

Big C++ projects are notorious for being a nightmare to build.

The point of this language is to make it so that you only need one thing: the compiler of this language.

You can write a large system program that builds very quickly and does not need any extra tools to build.

Ultimately even the linker would be deprecated: the compiler would output the executable file directly. But for practical reasons the language has to support linking in order to interop with C libraries.

Re: Making Reasonable Use of Computer Resources

#30
post #29

Earlier quoted context omitted.

The new way Jai does SoA is through just userland macros: https://www.youtube.com/watch?v=zgoqZtu15kI Tldr SoA isn't a single transformation. Depending on your data access pattern, you might want to shape the structure differently. Kinda like GPU. So first-classing a particular pattern of AoS->SoA conversion (the one we often see in tutorials) wouldn't have been enough. In this case, a little bit of tasteful usage of…

People focus too much on the SoA thing as if it was the whole point of the language, but it's really really not. Jon does a lot of programming streams, and I think anyone who watches his programming streams will recognize that "structure of arrays" is not the default mode that he usually programs in. That's not even the point of the language. Yes the language does a lot of what you expect from a modern systems langua…

Thanks for the great explanation. Do you know how it plans to handle dependencies? Is it expected to work on embedded platforms like Cortex-M?

It's nice seeing a mix of modern systems languages: Zig, Rust, Jai. All seem very well designed and promising.

Post reply on HN