HNHacker News
TopNewBestAskShowJobs

commonlisp94

144 karma · joined July 24, 2023

submissionscomments
commonlisp94··on Data centres account for between 1.5% and 2% of global electricity consumption
I assume you're using a screen to type this. Is there something inherently bad about videos on a screen? Or are you just unhappy with the content.
commonlisp94··on So you want to learn physics (2021)
> there is no actual fact of the matter.

This is true of all categories, so not a helpful comment. I suspect someone has a good enough definition.

commonlisp94··on What is a PID controller in an espresso machine?
All engineering technology is like this. The core of machine learning is multi-variable calculus and optimization that has been taught to math students since at least the 60s.

I bet most EE graduates still couldn't provide a good interpretation of a transfer function or a Laplace transform.

commonlisp94··on When to invest in marketing
And your customers know that too.
commonlisp94··on C and C++ prioritize performance over correctness
The assembly example isn't a good comparison. We have compilers that can generate a lot of assembly tricks most programmers wouldn't write. We don't have a way compiler that can analyze the logical constraints of a programming problem and simplify the data structures in the library.

> Generic code has proven itself time and time again, even Go caved in and supported it.

I'm not saying anything against the language feature generics. There is plenty of use for them even in a self contained code base.

commonlisp94··on C and C++ prioritize performance over correctness
> something about within an allocation and one past the end?

Yeah, I forgot about that. So I agree there is some subtly which is likely to catch beginners.

Your example could safely be:

   if (std::distance(begin, end) > 5) 
Another approach I would recommend is to write a `guarded_advance` which takes an integer and the end pointer.

Also note that the situation you are describing is still a little unusual because the baseline assumption is it takes linear time to advance an iterator by more than 1 increment.

> but neither will valid increment between two integers. No need for iterators in that case either.

The purpose of an iterator is to abstract data structure access. The coordinate inside a complex data structure may not be representable by an integer.

commonlisp94··on C and C++ prioritize performance over correctness
> A library author can spend ridiculous amounts of time

That's true. But simply having knowledge of the goal and a few simplifying assumptions can beat all the optimization in the world. In other words, a polished sub-optimal approach isn't as good as just having a better approach. `std::unordered_map` is heavily optimized, but can't make any tradeoffs because it's a general tool.

> plethora of generic C++ hash tables which would match, if not soundly outperform, their C counterpart.

Post one.

> not only is it possible to specialize generic code for particular types, but it's absolutely routine to do so.

Yep, it can do type base specialization, not application based specialization though. That requires a programmer.

> how do you explain qsort often being beaten by std::sort

a standard library C function often cannot be inlined to remove the comparison function pointer call, whereas std::sort trivially can.

If you wrote one yourself for a particular problem, it would not have this issue. This is actually a great example of where C excels because the choice of sorting algorithm so much depends on the kind of data you are sorting.

Let me be clear about my claim: tailor made solutions to each problem will almost always be faster than generic solutions. Do you really disagree with that? If you want to argue that maybe it's not productive to work that way, that's a different argument.

commonlisp94··on Career advice for young system programmers
What does this have to do with the discussion?
commonlisp94··on C and C++ prioritize performance over correctness
> implemented in Python,

A program which constructs an AST out of python classes and spits out GPU code is a compiler. The python is never executed.

Trivially, compilers can generate code faster than their hose language, but that doesn't make the host language fast. The compiler would be even faster if it were written in C++.

commonlisp94··on C and C++ prioritize performance over correctness
> with lots of undefined behavior at the corners.

What behavior is undefined in incrementing a pointer between a begin and end range?

commonlisp94··on C and C++ prioritize performance over correctness
A pointer is a valid C++ iterator.

> but you trust it to optimize all that garbage away?

Yep, if you learn about compilers you learn what kind of optimizations are easy and hard for them to make. The kind that just flattens a few levels of nested definitions are easier.

commonlisp94··on C and C++ prioritize performance over correctness
> It could be more performant

No, it almost always is. The designers of a generic library can't anticipate the use case, so can't make appropriate tradeoffs.

For example, compare `std::unordered_map` to any well written C hash table. The vast majority of hash tables will never have individual items removed from them, but a significant amount of complexity and performance is lost to this feature.

commonlisp94··on C and C++ prioritize performance over correctness
That's writing some other language in C syntax. You use arrays or you write a specialized version for the use case.
commonlisp94··on C and C++ prioritize performance over correctness
It's a nice thought, but in practice C binaries are orders of magnitude smaller than any other language. Also compilers make that tradeoff for inlining all the time.
commonlisp94··on Career advice for young system programmers
> having the education/degree does not help you correlate the day to day work in the field with what you learned

I also agree with that. The vast majority just aren't interested or did the minimum to pass classes, without really absorbing it.

What I disagree with is the self-taught correlation. The people who can do what you describe overwhelming are academically curious and have degrees.

> maybe getting the degree isn't necessarily the best path

I think you'll find a similar pattern in all fields. I think what's more in question is the ability of education to transform ingrained aptitudes and interests.

commonlisp94··on Career advice for young system programmers
I agree with that experience, but it's not clear how it relates to the topic we are discussing.
commonlisp94··on Career advice for young system programmers
> US-centric view of tertiary education being a risk due to large capital investment

I can't help but think European perception is a little exaggerated here. Yes, the live on campus and party at age 18/19 experience is expensive. But, getting a state school degree on a budget, and maybe a year of community college? You're looking at 10-30k.

The bigger risk is opportunity cost since degrees start later and take longer.

commonlisp94··on Career advice for young system programmers
> I also tend to read more papers and technical books

I have only met one self-taught person who reads anything like this. My experience is exactly the opposite. Most self-taught programmers are great at programming and solving business problems, but tend to be less technical and think academic stuff is a waste of time.

commonlisp94··on Things you forgot (or never knew) because of React
I don't know, but this point is already refuted:

> there can never be real progress ...

> without having a programming language that is powerful enough

Historically there have been plenty of interesting powerful languages on the periphery, but most of the useful stuff is not written with them.

commonlisp94··on Things you forgot (or never knew) because of React
The operating system you are using is written in C.
commonlisp94··on West Virginia University to drop 32 majors including all world language programs
I agree with this. Also, how/when did business sneak in here? that's the one that least belongs.
commonlisp94··on Paying consumer debts is basically optional in the United States
> they rely on the social norms of a society

Norms like being honest and not stealing? society gets really expensive and unfriendly when we have to use enforcement instead of norms.

commonlisp94··on Can you use a class in C?
In modern times, this only applied to MSDOS
commonlisp94··on Can you use a class in C?
It would make a huge difference if that style were used more in practice.

OOP is just functions that are only polymorphic in 1 argument, when you want it on all of them.

commonlisp94··on 80% of bosses say they regret earlier return-to-office plans
You're right, I left out a lot of life situations that could benefit. Let me be a little more specific:

- if you're young you probably want to be around others to learn from.

- if you're not well established, you want others to know you and see your impact.

- if you're struggling financially or to find a job, you probably don't want to compete with the whole world for basic employment (especially against low cost of living countries.)

So yes, if you just need a paycheck for skills you already have, and that can be done remotely, that can be convenient. If you are looking for more you need to consider these kinds of tradeoffs.

commonlisp94··on The Downsides of C++ Coroutines
> it’s an obvious choice to use coroutines.

I agree, but the other choice is to have traditional threads of execution that block. This simple strategy has delivered more successful projects than any other.

commonlisp94··on How a startup loses its spark
Organizations are structured as trees as a strategy to combat N^2 complexity. You talk up, or down. The tradeoff is of course N^2 relationships still exist in reality , so you duplicate effort, and sometimes collide, but it's a good tradeoff.
commonlisp94··on West Virginia University to drop 32 majors including all world language programs
> Gee says that due to the demographic cliff they’re expecting 20% fewer students ‘over the next period of time’,

> Alsop says that revenues will decrease over the next 4-5 years ‘given the demographic cliff’.

commonlisp94··on West Virginia University to drop 32 majors including all world language programs
It's actually the other way around. Universities were originally for humanities, and science and engineering got attached. Maybe we just need separate engineering schools.
commonlisp94··on West Virginia University to drop 32 majors including all world language programs
You just don't understand what's in a language degree. Also do you know a single person who has ever learned to actually speak a language with duolingo?
← PreviousPage 2 of 4Next →