HNHacker News
TopNewBestAskShowJobs

writebetterc

135 karma · joined January 16, 2025

submissionscomments
writebetterc··on Spotify won court order against Anna's Archive, taking down .org domain
> This is also a big party of why artists don’t earn shit.

The pie that Spotify divides up among the artists is a global one. It's not like you listen to one artist, so they get your 10 bucks every month. You're paying Taylor Swift, even though you never listen to her.

writebetterc··on Improving the performance of WAT parser
The grammar matters also, of course. A pure Python program is going to be much slower than the equivalent Rust program, just because CPython is so slow.

I don't know if this does semantic analysis of the program as well.

writebetterc··on Improving the performance of WAT parser
So it went from parsing at 25MiB/s to 115MiB/s. I feel like 115MiB/s is very slow for a Rust program, I wonder what it's up to that makes it so slow now. No diss to the author, good speedup, and it might be good enough for them.
writebetterc··on Deconstructing the LuaJIT Pseudo Memory Leak
This has to be AI slop text... It doesn't actually say what it does. If you've got a non-compacting GC that's fragmenting memory. If you need to release memory, then you better make sure that the blocks the GC is using are empty, and munmap them.
writebetterc··on Allow me to introduce, the Citroen C15
> (not counting emergency and service vehicles)

Just gotta read the last line too :P

writebetterc··on Allow me to introduce, the Citroen C15
> The solution to city air pollution is a different vehicle with a different drive train: an EV.

Priority list should basically be:

0. Bicycles 1. Metro 2. Buses 3. EVs

(not counting emergency and service vehicles)

writebetterc··on Eat Real Food
> chicken breast is more than twice as "good" ratio wise.

Yes, at more than twice the price for me.

> for the average person's protein intake, yes.

The average person doesn't need that ratio, reaching 60-90g of protein is trivial. That ratio is good for bodybuilding purposes. Now, eating that much tofu, that sucks. Generally, getting 200g of protein sucks, even when you eat protein powder.

writebetterc··on OLED, Not for Me
I'm on a M4 Macbook, and I can see it. I'm inclined to totally accept the blog author's experience as true for them, I'd probably experience the same thing.
writebetterc··on Eat Real Food
Tofu's ratio is really good, though? I can get 162kcal/18g of protein tofu here. Anything where P*10 > KCAL is a very good protein source, imo.
writebetterc··on Backing up Spotify
I am not, how did they solve that?
writebetterc··on Brent's Encapsulated C Programming Rules (2020)
I can't edit my comment any longer, but I really like nullprogram.com
writebetterc··on Brent's Encapsulated C Programming Rules (2020)
void* is basically used for ad-hoc polymorphism in C, and it is a vital part of C programming.

    void new_thread(void (*run)(void*), void* context);
^- This let's us pass arbitrary starting data to a new thread.

I don't know whether this counts as "very few use cases".

The Memory Ownership advice is maybe good, but why are you allocating in the copy routine if the caller is responsible for freeing it, anyway? This dependency on the global allocator creates an unnecessarily inflexible program design. I also don't get how the caller is supposed to know how to free the memory. What if the data structure is more complex, such as a binary tree?

It's preferable to have the caller allocate the memory.

    void insert(BinTree *tree, int key, BinTreeNode *node);
^- this is preferable to the variant where it takes the value as the third parameter. Of course, an intrusive variant is probably the best.

If you need to allocate for your own needs, then allow the user to pass in an allocator pointer (I guessed on function pointer syntax):

    struct allocator { void* (*new)(size_t size, size_t alignment); void (*free)(void* p, size_t size); void* context; }.*
writebetterc··on Applets are officially gone, but Java in the browser is better
No, it's not? Using a VM is one way of preventing buffer overflows, it's not orthogonal.
writebetterc··on Applets are officially gone, but Java in the browser is better
> A stack based machine? Why?

The JVM being a stack-machine is probably the least controversial thing about it. Wasm, CPython and Emacs all also have a stack-based bytecode language. The value, of course, comes from having a generic machine that you can then compile down into whatever machine code you want. Having a register machine doesn't seem very useful, as it's completely unnecessary for the front-end compiler to minimize register usage (the backend compiler will do that for you).

Specifying classpath isn't fun, I agree with that. Launch performance isn't good, and is generally a consequence of its high degree of dynamicism and JIT compiler, though of course there are ways around that (Leyden).

> I've written entire programs in JVM bytecode, without a compiler, and I see very little of value in it

I agree, I also see very little value in manually writing JVM bytecode programs. However, compiling into the JVM classfile format? Pretty darn useful.

writebetterc··on IBM CEO says there is 'no way' spending on AI data centers will pay off
I think it's the realm of maybe in Silicon Valley. That's 5000 dollars. Look at this statement:

> Let's say only about 1/3 of the world's adult population is poised to take advantage of paid tools enabled by AI

2/3 of the world's adult population is between 15 and 65 (roughly: 'working age'), so that's 50% of the working world that is capable of using AI with those numbers. India's GDP per capita is 2750USD, and now the price tag is even higher than 5k.

I don't know how to say this well, so I'll just blurt it out: I feel like I'm being quite aggressive, but I don't blame you or expect you to defend your statements or anything, though of course I'll read what you've got to say.

writebetterc··on IBM CEO says there is 'no way' spending on AI data centers will pay off
You're saying $8 billion to cover interest, another commenter said 80, but the actual article says ""$8 trillion of CapEx means you need roughly $800 billion of profit just to pay for the interest". Eight HUNDRED billion. Where does the eight come from, from 90% of these companies failing to make a return? If a few AI companies survive and thrive (which tbh, sure, why not?) then we're still gonna fall face down into concrete.
writebetterc··on URL in C (2011)
It's a joke
writebetterc··on URL in C (2011)
This is why you should only use /* */ as your comment style.
writebetterc··on Inside Rust's std and parking_lot mutexes – who wins?
>I am very familiar with how Java does locks. This is different. Look at the ParkingLot/parking_lot API. It lets you do much more than just locks, and there’s no direct equivalent of what Java VMs call the inflated or fat lock. The closest thing is the on demand created queue keyed by address.

Are you familiar with the new LightweightSynchronizer approach with an indirection via a table, instead of overwriting the markWord? I'd say that this has pushed the ParkingLot approach and Java's (Hotspot's, really) approach closer to each other than before. I think the table approach in Java could be encoded trivially into ParkingLot API, and the opposite maybe. Obviously the latter would be a lot more hamfisted.

writebetterc··on Implications of AI to schools
The students had identical answers, I presume
writebetterc··on Inside Rust's std and parking_lot mutexes – who wins?
This is very similar to how Java's object monitors are implemented. In OpenJDK, the markWord uses two bits to describe the state of an Object's monitor (see markWord.hpp:55). On contention, the monitor is said to become inflated, which basically means revving up a heavier lock and knowing how to find it.

I'm a bit disappointed though, I assumed that you had a way of only using 2 bits of an object's memory somehow, but it seems like the lock takes a full byte?

writebetterc··on Show HN: I wrote a minimal memory allocator in C
In a single-threaded context, I think 'giant array array of bytes' is still correct? Performance, not so much.

> This part of the blog didn't seem very accurate.

It was a sufficient amount of understanding to produce this allocator :-). I think that if we have beginner[0] projects posted and upvoted, we must understand that the author's understanding may be lacking some nuance.

[0] author might be a very good programmer, just not familiar with this particular area!

writebetterc··on Signal knows who you're talking to (2023)
Moxie doesn't want to federate, that's the main issue I believe.
writebetterc··on My stages of learning to be a socially normal person
The goal isn't to exchange facts, it's to bond.
writebetterc··on Transpiler, a Meaningless Word (2023)
To me, it doesn't. If someone says "tsc is a transpiler", it gives me nothing actionable. If you do say "it transpiles to JS", then I've got something, but that could just be "compiles to JS". It doesn't really tell me how the thing is constructed either.
writebetterc··on Transpiler, a Meaningless Word (2023)
What value does the word have? When I'm writing a compiler, it doesn't matter whether I target C or asm, or Javascript, as my output language. I'll still write it the same way.
writebetterc··on Transpiler, a Meaningless Word (2023)
I'd probably say that "transpiler" is not a very useful word with that definition.
writebetterc··on For centuries massive meals amazed visitors to Korea (2019)
I'm sure that if you went back 100 years you'd be less surprised, but of course the rice would've been replaced with oat porridge or potatoes.
writebetterc··on Talent Is Alignment
> I think this is a dumb idea, a mix of wishful thinking and immature psychology. You become someone because of your competence, not of what you believe in.

Shit works, it's not dumb at all.

writebetterc··on Don't avoid workplace politics
"good outcomes" doesn't have to be the best outcome for you, personally.
Page 1 of 3Next →